FANDOM


The input box function is mainly used to prompt the user for a string. Please keep in mind you don't use parenthesis [ ( and ) ] unless you are assigning the input box to a variable or you are using it in a statement.

Syntax:Edit

InputBox "Main text here", "Title here"

This syntax will create the following box: InputBox

There are 3 main sections to an input box. The first being the main text, the second being the title, and the third being the preset text. In the main text area, you write the message you want the box to display. You put the message in quotes. After the ending quote, you can put a comma [,] after it, and then put the title. If you don't put in a title at all, it would default to the application name. You also put the title in quotes. After the ending quote, you can put another comma [,] after it and then in quotes again, put your preset text.

In order to get the string returned by the user, you need either a Comparison or a Variable (With a variable, you will need a comparison later to see the value anyway). To check the variable, you would simply compare it with something or display it. The following is an example using an If Statement used for checking the text (Used as a password in this example).

If InputBox("Please enter the passcode.", "Restricted access") = "thisisthepassword" Then MsgBox "Correct passcode. You may continue."

This would create a prompt like this:CheckValueOfInputBox

The preset text parameter is used to have text already in the input area. Using the password example above, I'll just add in some preset text, namely 8 asterisks:

If InputBox("Please enter the passcode.", "Restricted access", "********") = "thisisthepassword" Then MsgBox "Correct passcode. You may continue."

This would create a box like this: PresetTextInputBox

If you don't want to include all the parameters (The main text, title, and preset text), then you simply leave that space empty. Such as if I only wanted the main text, I would do the following:

InputBox "Main text here"
Only title:
InputBox "", "Title here"
Only main text and title:
InputBox "Main text here", "Title here"
Only title and preset text:
InputBox "", "Title here", "Preset text here"
Only main text and preset text:
InputBox "Main text here", , "Preset text here"

Related:Edit

MsgBox

UCase and LCase (Functions)


Remember, if you ever need help, you can ask BusyCityGuy on his talk page.


Did you find what you needed?
 
35
 
16
 
18
 

The poll was created at 23:16 on June 10, 2012, and so far 69 people voted.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.