期待'结束' vbs错误

时间:2017-10-25 16:08:27

标签: vbscript

我的代码显然无效,你能帮忙吗?它用于学校项目。

x=msgbox("Hello. Make sure you dispose of this computer properly. You can donate to a local school, retirement home, charitable organization, or a community center. You can recycle it or resell it. Let's protect our enviornment one piece of tech at a time. Our tech. Our future. Our job.",1,"Proper Care")
If vbCancel then
    CreateObject("WScript.Shell").Run("http://bestanimations.com/Military/Explosions/earth-explosion-animated-gif-2.gif")
    If vbOK then
        CreateObject("WScript.Shell").Run("https://www.cta.tech/Consumer-Resources/Greener-Gadgets/Recycle-Electronics.aspx")
        x=msgbox("If you don't, we might have a horrible future.",16,"Help the environment")
    End If

2 个答案:

答案 0 :(得分:0)

If x=vbCancel then CreateObject("WScript.Shell").Run("http://bestanimations.com/Military/Explosions/earth-explosion-animated-gif-2.gif")

If x=vbOK then
        CreateObject("WScript.Shell").Run("https://www.cta.tech/Consumer-Resources/Greener-Gadgets/Recycle-Electronics.aspx")
        x=msgbox("If you don't, we might have a horrible future.",16,"Help the environment")
End If

答案 1 :(得分:0)

您有两个If语句,但只有一个End If语句。我猜你可能希望你的第二个If实际上是ElseIf

另外,说If vbCancel不符合你的想法。如果您要测试x的值,则需要测试x的值。