vbscriptmsgbox

How do I check if a button is pressed in a VBScript 'MsgBox'?


How do I check if I click on a button in a MsgBox?

x = msgbox("Test", 0+16, "Test")

I meant check, not how to make a message box!


Solution

  • Use:

    x = msgbox("Test", 0+16, "Test")
    
    if x = number then
        msgbox("Hello, World!")
    end if
    

    instead of the "number" in the if statement, write the number corresponding with the button that you want to check if pressed. Here are the numbers that you can write:

    1 - ok; 2 - cancel; 3 - abort; 4 - retry; 5 - ignore; 6 - yes; 7 - no