I am running a macro while in Private Sub Workbook_BeforeClose(Cancel As Boolean)
but whenever user clicks on Cancel button macro should not run.
I kept following lines of code
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Cancel = True Then
MsgBox "You clicked on Cancel"
ElseIf Cancel = False Then
Call SDA
End If
End Sub
But whenever i press Cancel button it is not showing me any MessageBox.Any help would be appreciated greatly.
Try this please:
The usual structure of a messagebox cancel event wrap is as follows: