Microsoft Office Tutorials and References
In Depth Information
MsgBox "Welcome to Excel."
The preceding procedure produces a simple message box with only the text and an OK
button displayed. Because the statement doesn’t include a value for the message box title, the title
defaults to the name of the application (as you can see in Figure 4-13).
It’s easy to create message boxes with brief welcome or informational
Besides using literal strings to display messages, you can also use string variables. The follow
ing code fragment displays a message box with two lines of text in the message, an informa
tion icon, and a title in the title bar, with the result shown in Figure 4-14.
strPrompt = "Welcome!" & vbCrLf & "Enter your travel data below."
MsgBox strPrompt, vbInformation, "Travel Voucher Records"
Figure 4-14. It’s not that much harder to create a simple message box with two lines of text.
When choosing an icon to display in the message box, you can use the following guidelines,
provided by Microsoft in the Windows User Interface guidelines:
The information icon should be used to provide results to the user of a command pre
viously issued. No choices should be offered, and only the OK button should ever be
displayed with the information icon.
The exclamation icon should be used to warn the user of a problem or situation that
requires a decision from the user before continuing. This is especially true of situations
where data might be irreversibly changed or erased.
The critical icon should be used to inform the user of a critical error or problem that
needs to be corrected before further processing can be done.
The question icon should not be used in any instance and is provided only for