Reputation: 213
I got this code from the Microsoft website.
The file saves whether I select Yes or No.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel as Boolean)
a = MsgBox("Do you really want to save the workbook?", vbYesNo)
If a = vbNo Then Cancel = True
End Sub
Upvotes: 0
Views: 111
Reputation: 687
What happens if you test
IF MsgBox("Do you really want to save the workbook?", vbYesNo) = vbNo then Cancel=True
Upvotes: 2