View Full Version : UserForm_QueryClose vs Unload Me
av8tordude
08-31-2011, 07:32 AM
In the Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer), is there a way to distinquish between clicking the "X" button on the userform vs unloading the form via a command button?
Kenneth Hobs
08-31-2011, 10:07 AM
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
MsgBox "Use a button to close this userform."
Cancel = True
End If
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.