Page 95 - Microsoft Office Excel 2003 Programming Inside Out
P. 95
VBA Programming Starter Kit
Table 4-9. Button Options for Message Boxes
Intrinsic Constant Value Description
Default Button
vbDefaultButton1 0 Sets the first button as the default button.
vbDefaultButton2 256 Sets the second button as the default button.
vbDefaultButton3 512 Sets the third button as the default button.
vbDefaultButton4 768 Sets the fourth button (such as a Help button)
as the default button.
Modality
vbApplicationModal 0€ Marks the message box as application modal.
Stops all processing of the current application
until the message box is dismissed. Does not
interfere with any other applications.
vbSystemModal 4096 Marks the message box as system modal; it will
always appear as the topmost window regardless
of which application the user switches to.
vbMsgBoxHelpButton 16384 Adds a Help button to the message box.
vbMsgBoxSetForeground 65536 Causes the message box to be displayed in the
foreground.
vbMsgBoxRight 524288 Causes the text in the message box to be right-
aligned.
vbMsgBoxRtlReading 1048576 Causes the text to be displayed right-to-left on
Chapter 4
Hebrew and Arabic systems.
Table 4-10. Values Returned by a Message Box
Intrinsic Constant Value
vbOk 1
vbCancel 2
vbAbort 3
vbRetry 4
vbIgnore 5
vbYes 6
vbNo 7
If a Cancel button is displayed in the message box, pressing Esc has the same effect as clicking
it. You should select exactly one option from each group; if more than one is selected, Excel
will use the option with the highest value.
You can display a simple message box just by providing the title argument.
69
Part 2: Visual Basic for Applications