Consulting

Results 1 to 2 of 2

Thread: UserForm_QueryClose vs Unload Me

  1. #1

    UserForm_QueryClose vs Unload Me

    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?

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    [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]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •