[英]Error Expected Loop VBScript
I have a script that opens up an excel file if the password provided is correct. 如果提供的密码正确,我有一个脚本可以打开excel文件。 If its wrong, it prompts a message.
如果错误,则提示消息。 It works perfectly when I add a loop at the end.
当我在末尾添加循环时,它可以完美工作。 However, the problem is whenever the password is wrong the script won't stop asking for the password because of the loop.
但是,问题在于,只要密码错误,脚本就不会因为循环而停止询问密码。 What I want is the script to quit/close if the password is wrong.
我想要的是如果密码错误可以退出/关闭的脚本。 I tried to remove the loop and replaced it with "wscript.quit" but it always prompts the message "expected loop".
我试图删除循环并将其替换为“ wscript.quit”,但是它总是提示消息“ expected loop”。 Here is the code I made.
这是我编写的代码。
password = "pass"
do
ask=inputbox ("Please enter password:","DProject")
select case ask
case password
answer=true
Set xl = CreateObject("Excel.application")
xl.Application.Workbooks.Open "C:\Users\test1\Desktop\test.xlsx"
xl.Application.Visible = True
Set xl = Nothing
wscript.quit
end select
answer=false
x=msgbox("Password incorrect... Aborting")
loop until answer=true
Is it possible to put a message like that counts when aborting. 是否有可能在中止时发出类似这样的消息。 like "Aborting in 3.... 2... 1".
例如“在3 .... 2 ... 1中终止”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.