Tuesday, November 22, 2011

MsgBox Function in VB Scripts

MsgBox Function
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.

Syntax
MsgBox(prompt, buttons, title, helpfile, context)

Parameter  Description

prompt         The text of the message to display in the message box dialog.
buttons     The sum of the Button, Icon, Default Button, and Modality constant values.
title          The title displayed in the Title-bar of the message box dialog.
helpfile     An expression specifying the name of the help file to provide help functionality for the dialog.
context      An expression specifying a context ID within helpfile.

Notes
  prompt can contain approximately 1,000 characters, including carriage return characters such as the built-in vbCrLf or vbNewLine constants.
  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" & vbNewLine & "This is line 2"
  If the helpfile parameter is provided, the context parameter must also be provided, and vice versa. 
  When both helpfile and context are passed to the MsgBox function, a Help button is automatically placed on the MsgBox dialog, allowing the user to
click and obtain context-sensitive help. 
  If you omit the buttons argument, the default value is 0; VBScript opens an application modal dialog containing only an OK button. 
  The following intrinsic constants can be added together to form a complete buttons argument

No comments:

Post a Comment