InputBox with multiple fields (inputs) using VBScript?

Posted on 2008-11-10
Last Modified: 2012-05-05
Does anyone know if it is possible to create an InputBox that contains multiple fields (inputs) on a single input box using VBScript?  I'd like to ba able to set three variables using a single InputBox, rather than using three consecutaive InputBoxes.
Question by:morciani
    LVL 67

    Accepted Solution

    You could have something like:

    Enter your selections, separating them with a comma:

    And then use the Split function to grab the data:

    arrValues = Split(strResponse, ",")

    Other than that, I don't know of a way...
    LVL 5

    Assisted Solution

    Another option is to make your script (or at least part of it) an HTA.
    This allows you to add several text boxes (or other controls) without having to click okay multiple times.

    <TITLE>HTA Sample</TITLE>
    	applicationname="HTA Sample"
    <SCRIPT language="vbscript">
    Sub RunThisSubroutine
    	str1 = TextBox1.Value
    	str2 = TextBox2.Value
    	str3 = TextBox3.Value
    	msgBox str1 & ", " & str2 & ", " & str3
    End Sub
    <BODY STYLE="FONT:10 pt verdana; COLOR:black; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FFCC66', EndColorStr='#FFFFFF')">
    Hyper Text Applications make it easy to add user inputs: <BR>
    <input type="text" name="TextBox1" size="30"><BR><BR>
    <input type="text" name="TextBox2" size="30"><BR><BR>
    <input type="text" name="TextBox3" size="30" value="A default value can go here"><BR><BR>
    <input id=runbutton class= "button" type="button" value="Run" name="button1" onClick="RunThisSubroutine">

    Open in new window

    LVL 5

    Expert Comment

    Oh, you need to save the above script as "whatever.HTA"
    (it might have been obvious, but just in case).
    LVL 65

    Expert Comment

    Hi, VBScript itself is not capable of this.  You could either build a HTA:

    You could also try this custom message box component:

    although I haven't used it yet, and I'm not sure if it support multiple inputs....


    LVL 65

    Expert Comment

    Ah, didn't refresh for 15 minutes.....zabu has provided a good HTA example...


    Author Closing Comment

    Excellent.... both solutions work!
    LVL 9

    Expert Comment

    For others looking for a solution:

    Depending on why you want multi-line input, you might also be able to use the clipboard instead of an input field.

    Code example by 'E'

    Full post on

    Worked for me :-)

    Best regards,

    Dim fso
    Dim objIE
    Dim sText
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set objIE = CreateObject("InternetExplorer.Application")
    objIE.Navigate "about:blank"
    Do Until objIE.ReadyState=4: WScript.Sleep 1: Loop
    sText = objIE.Document.ParentWindow.ClipboardData.GetData("text")
    objIE.Document.ParentWindow.ClipboardData.SetData "Text", sText

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Unlike scripting languages such as C# where a semi-colon is used to indicate the end of a command, Microsoft's VBScript language relies on line breaks to determine when a command begins and ends. As you can imagine, this quickly results in messy cod…
    Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now