我试图使取消函数适用于我的数组,它适用于简单的输入框,但 Array(InputBox( 不太喜欢它。
工作代码。
If strVarValue = vbNullString Then
MsgBox ("User canceled!")
WScript.Quit
End If
我需要什么帮助
strIPAddress = Array(InputBox("IP address"))
If strIPAddress = vbNullString Then
MsgBox ("User canceled!")
WScript.Quit
End If
不喜欢数组,因此我会遇到类型不匹配的问题。
仅当用户未按“取消”时才进行转换:
userInput = InputBox("IP address")
If userInput = "" Then
MsgBox ("User canceled!")
WScript.Quit
End If
strIPAddress = Array(userInput)
另外,如果您想区分“用户按下取消”和“用户按下确定而不输入值”,您需要检查变量是否为Empty
:
userInput = InputBox("IP address")
If IsEmpty(userInput) Then
MsgBox ("User canceled!")
WScript.Quit
ElseIf userInput = "" Then
MsgBox ("Missing input!")
WScript.Quit 1
End If
strIPAddress = Array(userInput)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)