Name
InputBox Function
Class
Microsoft.VisualBasic.Interaction
Syntax
InputBox(prompt[, title] [, defaultresponse] [, xpos] _[, ypos])
-
prompt Use: Required
Data Type: String
The message in the dialog box
-
title Use: Optional
Data Type: String
The title bar of the dialog box
-
defaultresponse Use: Optional
Data Type: String
String to be displayed in the text box on loading
-
xpos Use: Optional
Data Type: Numeric
The distance in twips from the left-hand side of the screen to the left-hand side of the dialog box
-
ypos Use: Optional
Data Type: Numeric
The distance in twips from the top of the screen to the top of the dialog box
Return Value
A String containing the contents of the text box from the
InputBox dialog box.
Description
Displays a dialog box containing a prompt for the user, a text box for entering data, and an OK, a Cancel, 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. Thus, once again, Microsoft has apparently made it impossible for us to distinguish when the user enters the empty string and when the user hits the Cancel button.
promptcan contain approximately 1,000 characters, including nonprinting characters like the intrinsicvbCrLfconstant.If the
titleargument is omitted, the name of the current application or project is displayed in the title bar.If you don’t use the
defaultparameter to specify a default entry for the text box, the text ...
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