vba VBScript 中用于输入的多个文本框
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21794600/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Multiple TextBox for Input in VBScript
提问by arunpandiyarajhen
Can we have multiple input text boxes in VBScript? I'm trying to create a form window using VBScript itself. I should get two values as input. Please help me.
我们可以在 VBScript 中有多个输入文本框吗?我正在尝试使用 VBScript 本身创建一个表单窗口。我应该得到两个值作为输入。请帮我。
回答by Bond
You have a few options that I can see.
你有几个我可以看到的选项。
- Create an HTA that contains multiple textboxes for input.
- Call InputBox() once for each input required.
- Develop your input form as COM ActiveX control that can be instantiated from VBScript. With RegFree, you don't need to install this COM control on your clients.
If it makes sense to do so, use a single InputBox() but ask the user to delimit their input. Here's an example of this technique. Note the use of the default parameter to demonstrate to the user what you're looking for.
Do s = InputBox("Enter the starting and ending years:", "Year Range", "2010-2014") Loop While Len(s) > 0 And InStr(s, "-") = 0 If Len(s) = 0 Then ' No input or cancel clicked Else s = Split(s, "-") End If
- 创建一个包含多个输入文本框的 HTA。
- 为每个需要的输入调用 InputBox() 一次。
- 将您的输入表单开发为可以从 VBScript 实例化的 COM ActiveX 控件。使用 RegFree,您无需在客户端上安装此 COM 控件。
如果这样做有意义,请使用单个 InputBox() 但要求用户分隔他们的输入。下面是这种技术的一个例子。请注意使用默认参数向用户展示您要查找的内容。
Do s = InputBox("Enter the starting and ending years:", "Year Range", "2010-2014") Loop While Len(s) > 0 And InStr(s, "-") = 0 If Len(s) = 0 Then ' No input or cancel clicked Else s = Split(s, "-") End If
回答by omegastripes
This is possible with HTA via VBScript.
Try this one http://forum.script-coding.com/viewtopic.php?pid=75356#p75356
Just add the second inputbox.
这可以通过 VBScript 使用 HTA 实现。
试试这个http://forum.script-coding.com/viewtopic.php?pid=75356#p75356
只需添加第二个输入框。
回答by AWS-Cloud-Architect-Rob
IN a form no you cannot, but you could do this in VBS, It would list a series of input box's and the input to the frst box can be used in the title and/or description of the next text box
在表格中,您不能,但您可以在 VBS 中执行此操作,它会列出一系列输入框,并且可以在下一个文本框的标题和/或描述中使用第一个框的输入
Firstresponse = inputbox("Enter Message", "Enter your Title")
Secondresponse = inputbox("Enter Message " & Firstresponse, "Enter your Title")