InputBox function
Displays a prompt in the dialog box, waits for the user to enter text or clicks a button, and returns the contents of the text box.
InputBox(prompt[,
title][,default][,xpos][,ypos][,helpfile,context])
Parameters
Prompt
A string expression that is displayed as a message in the dialog box. The maximum length of a prompt is approximately 1024 characters, depending on the width of the character being used. If the prompt contains more than one row, the combination of a carriage return (Chr), anewline character (Chr), or a carriage returnline break can be made between the rows (Chr (& Chr) to separate thelines.
Title
A string expression displayed in the title bar of the dialog box. If you omit title, the name of the application is displayed in the title bar.
Default
A string expression displayed in a text box that is the default response value when there is no other input. If defaultis omitted, the text box is empty.
Xpos
A numeric expression that specifies the horizontal distance (in twips) of the left edge of the dialog box and the left edge of the screen. If xposis omitted, the dialog box is centered horizontally.
Ypos
A numeric expression that specifies the vertical distance (in twips) of the top edge of the dialog box and the top edge of the screen. If yposis omitted, the dialog box displays approximately one-third of the vertical orientation of the screen from the bottom edge.
Helpfile
A string expression identifying the Help file that provides context-sensitive Help for a dialog box. If HelpFileis provided, the context must be provided.
Context
A numeric expression that identifies the context number assigned to a Help topic by the author of the Help file. If the context is already provided, HelpFilemust be provided.
Description
If both the HelpFile and Context are provided, the Help button is automatically added to the dialog box.
If the user clicks OK or presses ENTER, the InputBox function returns the contents of the text box. If the user clicks Cancel , the function returns a 0-length string ("").
The following example uses the InputBox function to display an input box and assign the string to the input variable:
InputBox("Enter name ") MsgBox (" input:" & Input)