AlexanderBB
Well-known Member
- Joined
- Jul 1, 2009
- Messages
- 1,940
- Office Version
- 2019
- 2016
- Platform
- Windows
I want to use the Form X Close event and btnSave event to run the same prompt e.g
The problem is "Unload Me' runs the QueryClose again.
What might be the correct way to handle this? Is CloseMode an option ?
VBA Code:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Select Case MsgBox("Save changes", vbYesNoCancel + vbQuestion)
Case vbYes
Stop
Case vbNo
Unload Me
Case Else
Cancel = True
End Select
End Sub
Private Sub btnSave_Click()
UserForm_QueryClose 0, 0
End Sub
The problem is "Unload Me' runs the QueryClose again.
What might be the correct way to handle this? Is CloseMode an option ?