MsgBox Function

Displays a message in a dialog box, waits for the user to click a button, and returns an Integer indicating which button the user clicked.

 

Syntax

 

MsgBox(prompt[, buttons] [, title] [, helpfile, context])

 

The MsgBox function syntax has these named arguments:

 

Part      Description

Constant                                             Value  Description

vbOKOnly                                           0          Display OK button only.

vbOKCancel                                        1          Display OK and Cancel buttons.

vbAbortRetryIgnore                             2          Display Abort, Retry, and Ignore buttons.

vbYesNoCancel                                   3          Display Yes, No, and Cancel buttons.

vbYesNo                                             4          Display Yes and No buttons.

vbRetryCancel                                      5          Display Retry and Cancel buttons.

vbCritical                                              16        Display Critical Message icon.

vbQuestion                                           32        Display Warning Query icon.

vbExclamation                                      48        Display Warning Message icon.

vbInformation                                       64        Display Information Message icon.