Msgbox Function: Yourmsg Msgbox (Prompt, Style Value, Title)

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

MsgBox ( ) Function

The objective of MsgBox is to produce a pop-up message box and prompt the user to click on a
command button before he /she can continues. This format is as follows:
yourMsg=MsgBox(Prompt, Style Value, Title)

The first argument, Prompt, will display the message in the message box. The Style Value will
determine what type of command buttons appear on the message box, please refer to Table 12.1 for
types of command button displayed. The Title argument will display the title of the message board.

Table 12.1: Style Values

Style Value

0
1
2
3
4
5

Named Constant

Buttons Displayed

vbOkOnly
vbOkCancel
vbAbortRetryIgnore
vbYesNoCancel
vbYesNo
vbRetryCancel

Ok button
Ok and Cancel buttons
Abort, Retry and Ignore buttons.
Yes, No and Cancel buttons
Yes and No buttons
Retry and Cancel buttons

Table 12.2 : Return Values and Command Buttons

Value

Named Constant

vbOk

vbCancel

vbAbort

vbRetry

vbIgnore

vbYes

Button
Clicked

Ok
button
Cancel
button
Abort
button
Retry
button
Ignore
button
Yes
button

No
button

vbNo

Table 12.3: Message box with icon


Value

Named Constant

16

vbCritical

32

vbQuestion

48

vbExclamation

64

vbInformation

Icon

You might also like