Message Box Constants
Except for vbMsgBoxHelpButton
, any one of the
following constants can be used with the
buttons
parameters of the
MsgBox
function to determine which buttons
appear in the dialog. The vbMsgBoxHelpButton
constant can be logically ORed with the button constant to add a Help
button to provide context-sensitive help; this, however, also
requires that arguments be supplied to the function’s
helpfile
and
context
parameters.
Constant |
Value |
Description |
---|---|---|
|
2 |
Abort, Retry, and Ignore buttons |
|
16384 |
Help button |
|
1 |
OK and Cancel buttons |
|
0 |
OK button; this is the default value. |
|
5 |
Retry and Cancel buttons |
|
4 |
Yes and No buttons |
|
3 |
Yes, No, and Cancel buttons |
You can determine which of these buttons is the default (that is, it
appears selected and will be chosen if the user presses the Enter
key) by logically ORing any one of the following constants with any
other constants passed to the buttons
parameter. The selected button is designated by its position on the
dialog. By default, the first button appears selected.
Constant |
Value |
Description |
---|---|---|
|
0 |
First button is the default |
|
256 |
Second button is the default |
|
512 |
Third button is the default |
|
768 |
Fourth (Help) button is the default |
The MsgBox
function also allows you to designate an icon that appears in the message box to ...
Get VBScript in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.