Display a message box by using Visual Basic

  1. Create a Visual Basic procedure.

    How?

  2. Add an assignment statement to the procedure that assigns the value returned by the MsgBox function to a variable. The function returns different values depending on the button a user clicks in the message box. Your procedure can then perform different operations based on the value returned.

    For example, the following assignment statement runs the MsgBox function, displaying a message, and assigns the value returned by the function to the variable RetValue:

    RetValue = MsgBox("Continue?", vbOKCancel)

  3. Run the procedure.

    How?

For information about the MsgBox function, click .