Board logo

标题: [问题求助] VBS怎样将用户4次输入改成1次输入? [打印本页]

作者: zengfuyang    时间: 2012-8-23 18:03     标题: VBS怎样将用户4次输入改成1次输入?

本帖最后由 zengfuyang 于 2013-3-24 16:27 编辑

现在我有4条让用户输入的语句,因为4次输入太麻烦,想一次性输入,可以吗?代码如下:
strOne = InputBox("Please type one string","Input")

strTwo= InputBox("Please type two string","Input")

strThree = InputBox("Please type three string","Input")

strFour = InputBox("Please type you four string","Input")

求大神帮忙啊!
作者: broly    时间: 2012-8-29 22:59

  1. Dim arr
  2. arr = Array("One","Two","Three","Four")
  3. For var = 0 To UBound(arr)
  4. Execute("str"&arr(var)&" = InputBox(""Please type " & _
  5. LCase(arr(var))&" string"",""Input"")")
  6. Next
复制代码

作者: broly    时间: 2012-8-29 23:09

理解错误。
  1. Dim str,arr
  2. str = InputBox("多次输入,用'#'字符隔开","Input")
  3. arr = Split(str,"#")
  4. For Each var In arr
  5. MsgBox var
  6. Next
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2