YouTip LogoYouTip

Func Inputbox

* * Complete VBScript Reference Manual](#) * * * The InputBox function displays a dialog box where the user can enter text and/or click a button. If the user clicks the OK button or presses the ENTER key on the keyboard, the InputBox function returns the text from the text box. If the user clicks the Cancel button, the function returns an empty string (""). **Note:** If both the helpfile and context parameters are specified, a Help button will be added to the dialog box. **Tip:** See also the MsgBox function. ### Syntax InputBox(prompt[,title][,default][,xpos][,ypos][,helpfile,context]) | Parameter | Description | | --- | --- | | prompt | Required. The message displayed in the dialog box. The maximum length of prompt is approximately 1024 characters, depending on the width of the characters used. If prompt contains multiple lines, you can separate the lines using a carriage return character (Chr(13)), a linefeed character (Chr(10)), or a carriage return and linefeed combination (Chr(13) & Chr(10)). | | title | Optional. The title of the dialog box. The default is the application name. | | default | Optional. A default text in the text box. | | xpos | Optional. A numeric expression specifying the horizontal distance (in twips*) from the left edge of the dialog box to the left edge of the screen. If xpos is omitted, the dialog box is horizontally centered. | | ypos | Optional. A numeric expression specifying the vertical distance (in twips*) from the top edge of the dialog box to the top edge of the screen. If ypos is omitted, the dialog box is displayed approximately one-third of the way down from the top of the screen. | | helpfile | Optional. A string expression that identifies the help file that provides context-sensitive help for the dialog box. Must be used together with the context parameter. | | context | Optional. A numeric expression that identifies the context number assigned to the appropriate help topic by the help file author. Must be used together with the helpfile parameter. | * A twip is a unit of measurement that is visually identical to the system display. 1 twip is 1/1440 inch. ## Examples ## Example 1 Function myFunction() fname=InputBox("Enter your name") End Function [Try it Β»](#) ## Example 2 A prompt box with a title: Function myFunction() fname=InputBox("Enter your name","Userinput") End Function [Try it Β»](#) ## Example 3 A prompt box with default text in the input box: Function myFunction() fname=InputBox("Enter your name",,"Donald Duck") End Function [Try it Β»](#) ## Example 4 A prompt box displayed 700 twips* from the left edge of the screen. Function myFunction() fname=InputBox("Enter your name",,,700) End Function [Try it Β»](#) ## Example 5 A prompt box displayed 500 twips* from the top edge of the screen. Function myFunction() fname=InputBox("Enter your name",,,,500) End Function [Try it Β»](#) * * Complete VBScript Reference Manual](#)
← Ws SummaryFunc Getref β†’