Msg.Open (method)

Syntax

Msg.Open prompt,timeout,cancel,thermometer [,XPos,YPos]

Description

Displays a message in a dialog box with an optional Cancel button and thermometer.

Comments

The Msg.Open method takes the following named parameters:

 

Parameter

Description

 

prompt

String containing the text to be displayed. The text can be changed using the Msg.Text property.

 

timeout

Integer specifying the number of seconds before the dialog box is automatically removed. The timeout parameter has no effect if its value is 0.

 

cancel

Boolean controlling whether or not a Cancel button appears within the dialog box beneath the displayed message. If this parameter is True, then a Cancel button appears. If it is not specified or False, then no Cancel button is created. If a user chooses the Cancel button at runtime, a trappable runtime error is generated (error number 18). In this manner, a message dialog box can be displayed and processing can continue as normal, aborting only when the user cancels the process by choosing the Cancel button.

 

thermometer

Boolean controlling whether the dialog box contains a thermometer. If this parameter is True, then a thermometer is created between the text and the optional Cancel button. The thermometer initially indicates 0% complete and can be changed using the Msg.Thermometer property.

 

XPos, YPos

Integer coordinates specifying the location of the upper left corner of the message box, in twips (twentieths of a point). If these parameters are not specified, then the window is centered on top of the application.

 

Unlike other dialog boxes, a message dialog box remains open until the user selects Cancel, the timeout has expired, or the Msg.Close method is executed (this is sometimes referred to as modeless).

Only a single message window can be opened at any one time. The message window is removed automatically when a script terminates.

The Cancel button, if present, can be selected using either the mouse or keyboard. However, these events will never reach the message dialog unless you periodically call DoEvents from within your script.

Example

This example displays several types of message boxes.

Sub Main()

  Msg.Open "Printing. Please wait...",0,True,False

  Sleep 3000

  Msg.Close

  Msg.Open "Printing. Please wait...",0,True,True

  For x = 1 to 100

    Msg.Thermometer = x

  Next x

  Sleep 1000

  Msg.Close

End Sub

See Also

Msg.Close (method); Msg.Thermometer (property); Msg.Text (property).

More information

M