I've set up a button to save the workbook. I needed to force users to use the button and not bypass it by using the save or save as options on the menu. So I created a public variable in one of the modules called Ok2Save. When the button is used the variable is set to 1 just before saving then back to zero after the save.
In ThisWorkbook I created a BeforeSave routine that checks the public variable. If it is zero it cancels the save end exits.
Here is the code in the BeforeSave:
If Ok2Save = 0 Then
MsgBox "These save functions have been disabled. Use the SAVE ESTIMATE or SAVE THIS WORKBOOK buttons as applicable."
Cancel = True
Exit Sub
End If
It was working initially but after closing and re-opening the spreadsheet I now get an error 438 "Object doesn't support this property or method."
it highlights the first line of the code. When I check the variable it is set to 1 as it should be. So the global variable is set properly.
Why am I getting this error?
Bookmarks