InputBox Action

This action generates a dialog box for user input.

Use

The dialog box displays the MbQuestion icon, has a title, prompt, entry field and two buttons, OK and Cancel.

Figure 1. An input box with pre-set Value.

Parameters

Title  -  (Sting, Required)

Specifies the text that will display in the title bar of the input box. To display a blank title bar specify "". To specify the title as an expression, prefix the title with an equals (=) sign.

Message  -  (String, Required)

Specifies the message that will display in the body of the input box. To specify the message as an expression, prefix the message with an equals (=) sign.

Value  -  (Variable, Required)

A variable must be assigned to the Value parameter of this action. The value of this variable determines the default text displayed in the entry field when the input box is first generated. If the user clicks OK (or presses Enter), the current text of the entry field will be assigned to the variable. If the user clicks the Cancel button (or presses the Escape key), then this variable will be assigned an empty string.

If you wish generate an input box with an empty entry field you can set the variable to equal an empty string "".

Result  -  (Variable, Optional)

If specified, this variable will be assigned a value indicating which button the user pressed. After the input box is dismissed, the return value will be either: 1 - the user clicked the OK button or ENTER was pressed, or 2 - the user clicked the Cancel button or ESC was pressed.

Example

The following macro would generate the InputBox in Figure 1 (above):

If a user enters the customer number 1234-BE and clicks the OK button then CustomerNumber would be assigned the string "1234-BE" and ButtonPressed would be assigned the value 1.

See Also

MsgBox action | InputBox method