How To Make A VBA Msgbox Yes No

You can use a VBA Msgbox Yes No to get guidance from the user an the control your program’s flow

In the following example I am asking the user to confirm whether or not they want to continue.

I am storing the answer in the integer variable intAnswer, and then my algorithm processes their answer which
will ultimately control the flow of the program.

Sub VBAMsgboxYesNo()
    Dim intAnswer As Integer
    intAnswer = MsgBox("Would you like to continue", vbYesNo, "Continue?")
    Select Case intAnswer
        Case vbYes
            MsgBox "Continue", vbInformation, "Answer"
        Case vbNo
            MsgBox "Stop", vbInformation, "Answer"
    End Select

End Sub

Please let me know if you have any questions.

Offsite Related Information:

“Go Fund Me” Page

($5 suggested amount)

(…10% of your gift amount will go to charity)

Free! Subscribe To Our YouTube Channel!

Free MS Access VBA Programming Course

Facebooktwitterredditpinterestlinkedinmailby feather