?
Solved

InputBox with multiple fields (inputs) using VBScript?

Posted on 2008-11-10
7
Medium Priority
?
19,587 Views
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.
0
Comment
Question by:morciani
7 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 1000 total points
ID: 22924085
You could have something like:

Enter your selections, separating them with a comma:
Response1,Response2,Response3

And then use the Split function to grab the data:

arrValues = Split(strResponse, ",")

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

Assisted Solution

by:zabu99
zabu99 earned 1000 total points
ID: 22925177
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.



<HEAD>
<TITLE>HTA Sample</TITLE>
<hta:application
	applicationname="HTA Sample"
	scroll="yes"
	singleinstance'"yes"
	>
</HEAD>
 
<SCRIPT language="vbscript">
 
Sub RunThisSubroutine
	str1 = TextBox1.Value
	str2 = TextBox2.Value
	str3 = TextBox3.Value
	msgBox str1 & ", " & str2 & ", " & str3
End Sub
 
</SCRIPT>
 
<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">
 
</BODY>

Open in new window

0
 
LVL 5

Expert Comment

by:zabu99
ID: 22925186
Oh, you need to save the above script as "whatever.HTA"
(it might have been obvious, but just in case).
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 65

Expert Comment

by:RobSampson
ID: 22925288
Hi, VBScript itself is not capable of this.  You could either build a HTA:
http://www.microsoft.com/technet/scriptcenter/hubs/htas.mspx

You could also try this custom message box component:
http://www.jsware.net/jsware/scripts.php5#msgb

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

Regards,

Rob.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 22925295
Ah, didn't refresh for 15 minutes.....zabu has provided a good HTA example...

Rob.
0
 

Author Closing Comment

by:morciani
ID: 31515269
Excellent.... both solutions work!
0
 
LVL 9

Expert Comment

by:Outin
ID: 25021491
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 http://www.actuarialoutpost.com/actuarial_discussion_forum/showthread.php?p=3613458

Worked for me :-)

Best regards,
Outin

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
objIE.Quit

Open in new window

0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

850 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