Jump to content
Sign in to follow this  

cancel option in msgbox

Recommended Posts


Hi Guys!

I used a Msgbox with "1" flag in my script, but when I ran the script and clicked on the Cancel button, the script continues to be executed. How can I cancel the script by clicking on the cancel button?

Really need help!


Share this post

Link to post
Share on other sites

Yo suplada,

Try This::

$MsgRet = MsgBox(1,"Hello "& @USERNAME,"Would you like to continue?")
IF $MsgRet = 2 THEN EXIT
MsgBox(0,"","You clicked ok")

If you check out the helpfile on MsgBox() You will see that the cancel button returns with a msg code of 2.

By allocating a variable to the return value of MsgBox, you can retrieve and use these msg codes.


Edited by Mobius
  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.