Name
InputBox Function
Syntax
InputBox(prompt[,title] [,default] [,xpos] [,ypos] [,helpfile,context])
promptUse: Required
Data Type: String
The message in the dialog box.
titleUse: Optional
Data Type: String
The titlebar of the dialog box.
defaultUse: Optional
Data Type: String
String to be displayed in the text box on loading.
xposUse: Optional
Data Type: Numeric
The distance from the left side of the screen to the left side of the dialog box.
yposUse: Optional
Data Type: Numeric
The distance from the top of the screen to the top of the dialog box.
helpfileUse: Optional
Data Type: String
The Help file to use if the user clicks the Help button on the dialog box.
contextUse: Optional
Data Type: Numeric
The context number to use within the Help file specified in
helpfile.
Return Value
InputBox returns a variant string containing the contents of the text box from the InputBox dialog.
Description
Displays a dialog box containing a label, which prompts the user about the data you expect them to input, a text box for entering the data, an OK button, a Cancel button, and optionally, a Help button. When the user clicks OK, the function returns the contents of the text box.
Rules at a Glance
If the user clicks Cancel, a zero-length string (” “) is returned.
promptcan contain approximately 1,000 characters, including nonprinting characters like the intrinsicvbCrLfconstant.If the
titleparameter is omitted, “VBScript” is displayed in the titlebar.If you don’t use the
defaultparameter to specify a default entry ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access