Microsoft Office Tutorials and References
In Depth Information
Chapter 4: Controlling Forms with VBA
is the text of the message, and title is the text to appear in the title bar of
the message. The buttons argument is a constant or sum of constants
specifying the buttons and icons to show in the box, as summarized in Table 4-1.
Table 4-1
Constants Used for the MsgBox Buttons Argument
Constant
Description
vbOKOnly
Display OK button only.
vbOKCancel
Display OK and Cancel buttons.
Display Abort, Retry, and Ignore buttons.
vbAbortRetryIgnore
Display Yes, No, and Cancel buttons.
vbYesNoCancel
Display Yes and No buttons.
vbYesNo
vbRetryCancel
Display Retry and Cancel buttons.
vbCritical
Display Critical icon.
vbQuestion
Display Question icon.
vbExclamation
Display Warning icon.
vbInformation
Display Information icon.
The following example statement shows a message box that contains a
Question icon and Yes and No buttons:
Dim myVar as Byte
myVar = MsgBox(“Are you sure?”,vbYesNo+vbQuestion)
Figure 4-1 shows the message box that the code displays when executed.
Figure 4-1:
Sample
MsgBox
message.
When someone clicks a button in the message box, the variable (myVar, in
this example) receives a value. That value tells you which button the person
clicked, as summarized in Table 4-2.
Search JabSto ::




Custom Search