I have created a userform that captures via a public variable if a save of the workbook is desired or not. I attempt to use this public variable result within the workbook beforesave event to either save the workbook or cancel the save (exit the beforesave event). Here is the code that I think should work but it doesn't as the workbook is saved in all instances.
I have found that the public variable approach works good and is working properly by returning the correct result (true/false) but the workbook is saved regardless of the result. Any ideas???
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Proper_Save.Show 'call userform to get public variable "savequestion" result
If savequestion = True Then 'exit the default save and go back to the program
Cancel = True
Exit Sub
End If
End Sub
I have found that the public variable approach works good and is working properly by returning the correct result (true/false) but the workbook is saved regardless of the result. Any ideas???