MsgBox Constants
- Updated2024-09-12
- 1 minute(s) read
Constants > MsgBox Constants
MsgBox Constants
These constants are integrated in VBS and need not be defined before use. Use these constants anywhere in your script to represent the displayed values.
The following constants specify which buttons and symbols are in the message box.
| Constant | Value | Description |
| vbOKOnly | 0 | Displays the OK button |
| vbOKCancel | 1 | Displays the OK button and the Cancel button |
| vbAbortRetryIgnore | 2 | Displays the Abort button, the Retry button, and the Ignore button |
| vbYesNoCancel | 3 | Displays the Yes button, the No button, and the Cancel button |
| vbYesNo | 4 | Displays the Yes button and the No button |
| vbRetryCancel | 5 | Displays the Retry button and the Cancel button |
| vbCritical | 16 | Displays the Stop symbol |
| vbQuestion | 32 | Displays the Question Mark symbol |
| vbExclamation | 48 | Displays the Warning symbol |
| vbInformation | 64 | Displays the Information symbol |
| vbDefaultButton1 | 0 | The first button is the default button |
| vbDefaultButton2 | 256 | The second button is the default button |
| vbDefaultButton3 | 512 | The third button is the default button |
| vbDefaultButton4 | 768 | The fourth button is the default button |
| vbApplicationModal | 0 | Application modal |
| vbSystemModal | 4096 | System modal |
| vbMsgBoxHelpButton | 16384 | Displays the Help button |
| vbMsgBoxRight | 52488 | Right-aligned message box |
| VbMsgBoxSetForeground | 65536 | Displays the message in the foreground |
| vbMsgBoxRtlReading | 1048576 | The writing direction of the message box is from right to left |
The following constants specify which button the user clicked to close the message box.
| Constant | Value | Description |
| vbOK | 1 | Clicked OK. |
| vbCancel | 2 | Click Cancel |
| vbAbort | 3 | Click Cancel |
| vbRetry | 4 | Click Retry |
| vbIgnore | 5 | Click Ignore |
| vbYes | 6 | Click Yes |
| vbNo | 7 | Click No |