This documentation is archived and is not being maintained.

_Application.InputBox Method 

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

Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in

Dim Prompt As String
Dim Title As Object
Dim Default As Object
Dim Left As Object
Dim Top As Object
Dim HelpFile As Object
Dim HelpContextID As Object
Dim Type As Object
Dim returnValue As Object
Dim _Application1 As _Application
returnValue = _Application1.InputBox(Prompt, Title, Default, Left, Top, HelpFile, HelpContextID, Type)

object InputBox(
	[In] string Prompt, 
	[In, Optional] object Title, 
	[In, Optional] object Default, 
	[In, Optional] object Left, 
	[In, Optional] object Top, 
	[In, Optional] object HelpFile, 
	[In, Optional] object HelpContextID, 
	[In, Optional] object Type
public System.Object InputBox(
	/*in*/System.String Prompt, 
	/*in*/System.Object Title, 
	/*in*/System.Object Default, 
	/*in*/System.Object Left, 
	/*in*/System.Object Top, 
	/*in*/System.Object HelpFile, 
	/*in*/System.Object HelpContextID, 
	/*in*/System.Object Type
function InputBox(
	 Prompt : String, 
	 Title : Object, 
	 Default : Object, 
	 Left : Object, 
	 Top : Object, 
	 HelpFile : Object, 
	 HelpContextID : Object, 
	 Type : Object
) : Object;



Required Object. The message to be displayed in the dialog box. This can be a string, a number, a date, or a Boolean value.


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


Optional Object. 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.


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


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


Optional Object. 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.


Optional Object. The context ID number of the Help topic in HelpFile.


Optional Object. Specifies the return data type. If this argument is omitted, the dialog box returns text. Can be one or a sum of the following values.




A formula


A number


Text (a string)


A logical value (True or False)


A cell reference, as a Range object


An error value, such as #N/A


An array of values

You can use the sum of the allowable values for Type. For example, for an input box that can accept both text and numbers, set Type to 1 + 2.

Use InputBox to display a simple dialog box so that you can enter information to be used in a macro. The dialog box has an OK button and a Cancel button. If you choose the OK button, InputBox returns the value entered in the dialog box. If you click the Cancel button, InputBox returns False.

If Type is 0, InputBox returns the formula in the form of text — for example, "=2*PI()/360". If there are any references in the formula, they are returned as A1-style references. (Use ConvertFormula to convert between reference styles.)

If Type is 8, InputBox returns a Range object.

If you use the InputBox method to ask the user for a formula, you must use the FormulaLocal property to assign the formula to a Range object. The input formula will be in the user's language.

The InputBox method differs from the InputBox function in that it allows selective validation of the user's input, and it can be used with Microsoft Excel objects, error values, and formulas. InputBox with no object qualifier calls the InputBox function.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms