Good afternoon!
I am trying to set up a Workbook so that using Save or Save As is disabled but Macro buttons that do specific Save As commands are allowed.
I have the following code which works well at disabling Save and Save As, but it won't allow macros that are tied to buttons to perform a Save As operation.
Full Disclosure, I posted a similar question on excelforum.com a few weeks ago but wasn't able to resolve the issue.
This is the code I am using. This code is in ThisworkBook.
[CODE
]Private Sub Workbook_BeforeClose(Cancel as Boolean)
ThisWorkbook.saved=True
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUi as Boolean, Cancel as Boolean)
Cancel=True
End Sub
[/CODE]
I tried adding this same code to the top of my "save as" macro but change True to False in both places. It allowed me to save the file using the macro buttons but also allowed Save and Save As to work normally
Any suggestions or thoughts or brickbats are welcome. I am stuck.
Thanks much!
Bill
I am trying to set up a Workbook so that using Save or Save As is disabled but Macro buttons that do specific Save As commands are allowed.
I have the following code which works well at disabling Save and Save As, but it won't allow macros that are tied to buttons to perform a Save As operation.
Full Disclosure, I posted a similar question on excelforum.com a few weeks ago but wasn't able to resolve the issue.
This is the code I am using. This code is in ThisworkBook.
[CODE
]Private Sub Workbook_BeforeClose(Cancel as Boolean)
ThisWorkbook.saved=True
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUi as Boolean, Cancel as Boolean)
Cancel=True
End Sub
[/CODE]
I tried adding this same code to the top of my "save as" macro but change True to False in both places. It allowed me to save the file using the macro buttons but also allowed Save and Save As to work normally
Any suggestions or thoughts or brickbats are welcome. I am stuck.
Thanks much!
Bill