Change Read-Only Recommended Prompt

B

brookly

' *.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!
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top