View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Change Read-Only Recommended Prompt

If you want to give the user the option to open readonly, I would probably
use the msgbox you mentioned w/yes and no buttons

Sub test()
Const WkBkPath = "H:\Book3.xls"
Dim Result As Boolean

If MsgBox("Open Read Only?", vbYesNo) = vbYes Then
Result = True
Else: Result = False
End If
Workbooks.Open Filename:=WkBkPath, ReadOnly:=Result, _
IgnoreReadOnlyRecommended:=True

End Sub

"brookly" wrote:

' *.xls' should be opened as read only unless you need to save changes.
Open as read-only?
Yes No Cancel

Is there code to disable the cancel option when this prompt comes up?

OR

Can I make something else happen when cancel is selected instead of
whatever excel tells it to do? Overriding the cancel button would be
fine as well.

I am opening a workbook with a commandbutton on a form in another
workbook. I want to give users the option of opening the workbook as
readonly or not, but if the cancel button is selected, it is not
returning to the form I need it to go to. I have tried making my own
msgbox with only a yes and no button, it just seems dimming the cancel
button would more simple if I knew where to start.

Any ideas?

Thanks!