Results 1 to 4 of 4

Thread: Exit prompt problem

  1. #1
    Guest

    Question Problem with exit prompt

    I have a problem with some code that i cant figure out whats is wrong. here it is:
    Code:
    Private Sub mnuExit_Click()
    MsgBox "Do you really want to exit", vbYesNo, "Exit"
    If vbYes Then
        End
        Else
        Cancel = 1
    End If
    End Sub
    When you click "Yes" it exits. When you click "no" it exits. what am i doing wrong. (keep in mind that i am a beginner)

    -Steve

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    I fixed your code:
    Code:
    Private Sub mnuExit_Click()
    Dim Respons As Long
    
    Respons = MsgBox "Do you really want to exit", vbYesNo, "Exit"
    If Respons = vbYes Then
        End
        Else
        Cancel = 1
    End If
    End Sub

  3. #3
    Guest

    Smile

    Thanks for the help.

  4. #4
    Guest
    Or use this.
    Code:
    If MsgBox("Do you want to exit", vbYesNo) = vbYes Then
        Unload Me
    End If

Posting Permissions

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



Click Here to Expand Forum to Full Width