Skip to Main Content
VBScript in a Nutshell, 2nd Edition
book

VBScript in a Nutshell, 2nd Edition

by Paul Lomax, Matt Childs, Ron Petrusha
March 2003
Intermediate to advanced content levelIntermediate to advanced
512 pages
14h 30m
English
O'Reilly Media, Inc.
Content preview from VBScript in a Nutshell, 2nd Edition

Name

MsgBox Function

Syntax

MsgBox(prompt[, buttons][, title][, helpfile, context])
prompt

Use: Required

Data Type: String

The text of the message to display in the message box dialog.

buttons

Use: Optional

Data Type: Numeric

The sum of the Button, Icon, Default Button, and Modality constant values.

title

Use: Optional

Data Type: String

The title displayed in the titlebar of the message box dialog.

helpfile

Use: Optional

Data Type: String

An expression specifying the name of the help file to provide help functionality for the dialog.

context

Use: Optional

Data Type: Numeric

An expression specifying a context ID within helpfile.

Return Value

An Integer indicating the button clicked by the user.

Description

Displays a dialog box containing a message, buttons, and optional icon to the user. The action taken by the user is returned by the function as an integer value.

Rules at a Glance

  • prompt can contain approximately 1,000 characters, including carriage return characters such as the built-in vbCrLf constant.

  • In order to divide prompt onto multiple lines, you can use any of the vbCr, vbLf, vbCrLf, or vbNewLine constants. For example:

    SMsg = "This is line 1" & vbCrLf & _
    "This is line 2"
  • If the title parameter is omitted, the text of title depends on the type of script being executed, as the following table shows:

Script type

Caption

ASP script

not applicable

IE script

“VBScript”

Outlook form

“VBScript”

WSH script

“VBScript”

  • If the helpfile parameter is provided, the context parameter must also be provided, and vice versa. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

VBScript in a Nutshell

VBScript in a Nutshell

Matt Childs, Paul Lomax, Ron Petrusha
Microsoft® PowerShell, VBScript and JScript® Bible

Microsoft® PowerShell, VBScript and JScript® Bible

William R. Stanek, James O'Neill, Jeffrey Rosen

Publisher Resources

ISBN: 0596004885Errata Page