InputBox Function |
Yes
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.
InputBox returns a variant string containing the contents of the text box from the InputBox dialog.
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.
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 or project is displayed in the titlebar.
If you don't use the default parameter to specify a default entry for the text box, the text box is shown empty; a zero-length string is returned if the user doesn't enter anything in the text box prior to clicking OK.
xpos and ypos are specified in twips. A twip is a device-independent unit of measurement that equals 1/20 of a point or 1/1440 of an inch).
If the xpos parameter is omitted, the dialog box is centered horizontally.
If the ypos parameter is omitted, the top of the dialog box is positioned approximately one-third of the way down the screen.
If the helpfile parameter is provided, the context parameter must also be provided, and vice versa.
In VB5 and in VBA applications, when both helpfile and context are passed to the InputBox function, a Help button is automatically placed on the InputBox dialog, allowing the user to click and obtain context-sensitive help. In VB4, the user wasn't presented with a Help button and could access help only by pressing the F1 key.
If you are omitting one or more optional arguments and are using subsequent arguments, you must use a comma to signify the missing parameter. For example, the following code fragment displays a prompt, a default string in the text box, and the help button, but default values are used for the title and positioning.
sString = InputBox("Enter it now", , "Something", , _ , "help.hlp", 321321)
Note that when using InputBox with VBA in Office applications, the maximum length of the prompt string is 256 characters.
3.142.12.246