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?
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?
[VBA]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
[/VBA]