Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MsgBox question

Status
Not open for further replies.

finitesimian

Programmer
Feb 11, 2006
29
US
Hi. I'm a novice, and I'm attempting to create a Msgbox prompt that gives the user the option to select yes/no/cancel before executing the rest of the code.

I know how to do it in vb.net, but I haven't been able to figure out the correct syntax that would make attachmate happy.
Here is what I *think* it's supposed to look like:

Code:
dim retvalue
retvalue =  Msgbox ("Do you want to select something?",4,"Selecting something")
        If retvalue = 6 then
               Msgbox("You picked yes. Now running the rest of this script.....")
               Sess0.Screen.sendkeys("<Home><Backtab>whatever keystrokes and whatnot<Enter>")
        Else UserAnswer = 7 then
               Msgbox("You picked no.")
        End If

Is this correct? If not, can you give me an example to show me the correct syntax? Thanks in advance.
 
BTW- the line that says "Else UserAnswer = 7 then" is supposed to say "Else retvalue = 7 then
 
Actually, never mind. I kept toying with it, and eventually got it to work. For future reference (just in case anyone else needs this information), here is how it needs to look:

Code:
Dim ynb As String
        ynb = "This is a yes/no box. Do you want to continue?"
        Dim tit As String 
        tit = "Make a choice"
        Dim sty As Integer
        sty = 4
        Dim res
        res = MsgBox(ynb, sty, tit)
        If res = 6 Then
            Msgbox "you picked yes"
            'from here, you can run whatever commands you want
        End If
        If res = 7 Then
            Msgbox "you picked no"
            'either do nothing, or run whatever commands
        End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top