47
A
rguments
prompt
String expression displayed as the message in the dialog box. The maximum length of the prompt
is approximately 1024 characters, depending on the width of the characters used. If the prompt
consists of more than one line, they can be separated by inserting a carriage return character
(
Chr(13
)), a linefeed character (
Chr(10
)), or carriage return–linefeed character combination
(
Chr(13
)) and (
Chr(10
)) between each line.
buttons
Numeric expression that is the sum of values specifying the number and type of buttons to
display, the icon style to use, the identity of the default button, and the modality of the message
box. If omitted, the default value for buttons is 0.
title
String expression displayed in the title bar of the dialog box. If you omit title, the application
name is placed in the title bar.
helpfile
String expression that identifies the Help file to use to provide context-sensitive Help for the
dialog box. If helpfile is provided, context must also be provided. This is not available on 16-bit
platforms.
conte
x
t
Numeric expression that identifies the Help context number assigned by the Help author to the
appropriate Help topic. If context is provided, helpfile must also be provided. This is not available
on 16-bit platforms.
Remarks
When both helpfile and context are provided, the user can press F1 to view the Help topic
corresponding to the context.
If the dialog box displays a Cancel button, pressing ESC has the same effect as clicking Cancel.
If the dialog box contains a Help button, context-sensitive Help is provided for the dialog box.
However, no value is returned until one of the other buttons is clicked.
When the MsgBox function is used with Microsoft Internet Explorer, the title of any dialog
presented always contains “VBScript:” to differentiate it from standard system dialogs.
The following example uses the MsgBox function to display a message box and return a value
describing which button was clicked:
Dim MyVar
MsgBo
x
205