How can I abort the End command when Cancel is pressed in the Dialog that is presented in the Form_Unload Sub? Many thanks.
My code I am currently using is as follows. The code at the moment ends the program even though the Cancel button was pressed.
My code I am currently using is as follows. The code at the moment ends the program even though the Cancel button was pressed.
Code:
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("Are you sure?", vbOKCancel) = vbOK Then
End
Else
'Cancel the unloading
End If
End Sub