Application InputBox Method Method

Purpose

Displays a dialog box for user input. Returns the information entered in the dialog box.

Syntax

InputBox(Prompt, Title, Default, Left, Top, HelpFile, HelpContextID, Type)

Required Parameters

Prompt

The message to be displayed in the dialog box. This can be a string, a number, a date, or a Boolean value (Microsoft Excel automatically coerces the value to a String before it is displayed).

Optional Parameters

Title

The title for the input box. If this argument is omitted, the default title is "Input."

Default

Specifies a value that will appear in the text box when the dialog box is initially displayed. If this argument is omitted, the text box is left empty. This value can be a Range object.

Left

Specifies an x position for the dialog box in relation to the upper-left corner of the screen, in points.

Top

Specifies a y position for the dialog box in relation to the upper-left corner of the screen, in points.

HelpFile

The name of the Help file for this input box. If the HelpFile and HelpContextID arguments are present, a Help button will appear in the dialog box.

HelpContextID

The context ID number of the Help topic in HelpFile.

Type

Specifies the return data type. If this argument is omitted, the dialog box returns text.