ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change Read-Only Recommended Prompt (https://www.excelbanter.com/excel-programming/357734-change-read-only-recommended-prompt.html)

brookly

Change Read-Only Recommended Prompt
 
' *.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!


JMB

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!




All times are GMT +1. The time now is 04:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com