如何阻止代码在 VBscript 中发生

How can I stop code from happening in VBscript

我希望当用户按下取消按钮时代码停止 这是代码

X=MsgBox("hi",0+22,"Discord")
yay=X=MsgBox("Do you want help?", 1+32, "Discord")
if yay= Cancel then
X=MsgBox("closing...", 0+32, "Discord")
End if
X=MsgBox("a wild messege has appered", 1+32, "Discord")
X=MsgBox("error the messege could not load", 0+16, "Discord")
X=MsgBox("do you want to restart?", 0+32, "Discord")
X=MsgBox("we found a virus you need to restart your computer", 0+32, "oops..")
X=MsgBox("Please restart your computer", 0+32, "Windows")

有什么建议告诉我

我稍微修改了你的代码

Dim X As Integer
Dim yay As Integer

Do
    
X = MsgBox("hi", 0 + 22, "Discord")
yay = X = MsgBox("Do you want help?", 1 + 32, "Discord")

If yay = 0 Then
X = MsgBox("closing...", 0 + 32, "Discord")
Exit Do
End If

X = MsgBox("a wild messege has appered", 1 + 32, "Discord")
X = MsgBox("error the messege could not load", 0 + 16, "Discord")
X = MsgBox("do you want to restart?", 0 + 32, "Discord")
X = MsgBox("we found a virus you need to restart your computer", 0 + 32, "oops..")
X = MsgBox("Please restart your computer", 0 + 32, "Windows")
    
Loop While 1 = 0