How To Make A VBA Message Box Yes No

 

Continuing on with our VBA message box theme, here is how
to create a “VBA message box yes no”

The message box can be used like a function to return a value.

Here I am going to return a value to determine if the user clicked
“yes” or “no”.

For this I am going to set up a VBA Procedure to test with:

Sub GetReponse()
    
    Dim intChoice As Integer
    
    intChoice = MsgBox("Would you like to proceed?", vbYesNo, "Get Response")

    Select Case intChoice
        Case vbYes
            DoCmd.OpenForm "Yes"
        Case vbNo
            DoCmd.OpenForm "No"
    End Select

End Sub

 




By the way, if you got or are getting value from the VBA information, please give me a tip, thanks!


These posts may help answer your question too...

Find Error Line Number in VBA With Erl

In this post you are going to find out a way of handling errors in your code with the Erl function. Erl displays the last label before the error Another alternative error handling solution is using labels at each point in long procedure. Here we get a random error: Here is the code behind the […]

Here Is A Customized Msgbox VBA Example

Here is an example of a customized VBA Msgbox. We giving some richtext and customizable flair to the rather ordinary message box. The following code provided with the code after the screenshot, is going to provide you with the ability to really make the ordinary message box shine! Sub MsgboxVBAExamples() Dialog.Box “VBAHowTo.com is your source […]

How To Use A Variable In A VBA Message Box.

In this post I’m going to show you how to use a variable in a vba message box. This is used commonly to notify the user that an entered item in a combo box is not in the list, also per this post it’s to display the error number or the error description to the […]

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 […]

Previous Post

How To Make A VBA Message Box OK Cancel

Next Post

How To Make A VBA Message Box