InputBox Function |
Named Arguments
Yes
Syntax
InputBox(prompt[, title] [, default] [, xpos] _ [, ypos] [, helpfile, context])
prompt
Use: Required
Data Type: String
The message in the dialog box.
title
Use: Optional
Data Type: String
The titlebar of the dialog box.
default
Use: Optional
Data Type: String
String to be displayed in the text box on loading.
xpos
Use: Optional
Data Type: Numeric
The distance from the left side of the screen to the left side of the dialog box.
ypos
Use: Optional
Data Type: Numeric
The distance from the top of the screen to the top of the dialog box.
helpfile
Use: Optional
Data Type: String
Specifies the Help file to use if the user clicks the Help button on the dialog box.
context
Use: Optional
Data Type: Numeric
Specifies 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.
prompt can contain approximately 1,000 characters, including nonprinting characters like the intrinsic vbCrLf constant.
If the title parameter is omitted, the name of the current application ...
Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.