Multiple message boxes, one after the other in AutoOpen or other?

O

OssieMac

If I have interpretted your request properly.

Sub Auto_Open()
Dim MyMsgBox

MyMsgBox = MsgBox("Script line 1." & vbCrLf & _
"Script line 2", _
vbOKCancel + vbExclamation, "REMEMBER ...")


Select Case MyMsgBox
Case vbOK
'Your code here for OK
MsgBox "User selected OK"
Case vbCancel
MsgBox "User selected cancel"
Exit Sub
End Select


End Sub
 
S

StargateFan

I can't find the answer to this one; perhaps I'm googling/searching
for the wrong search terms.

I have an AutoOpen script that works just great, but I need to string
at least one other message to it after pressing OK. (And cancel would
stop the boxes, naturally.)

Sub Auto_Open()
MyMsgBox = MsgBox("Script line 1." & vbCrLf & _
"Script line 2", _
vbOKOnly + vbExclamation, "REMEMBER ...")
End Sub

How could I tack on another message box, or perhaps 2, to the above?

Thank you! :eek:D
 
S

StargateFan

If I have interpretted your request properly.

Sub Auto_Open()
Dim MyMsgBox

MyMsgBox = MsgBox("Script line 1." & vbCrLf & _
"Script line 2", _
vbOKCancel + vbExclamation, "REMEMBER ...")


Select Case MyMsgBox
Case vbOK
'Your code here for OK
MsgBox "User selected OK"
Case vbCancel
MsgBox "User selected cancel"
Exit Sub
End Select


End Sub

<lol> No, sorry. I really wasn't clear! Sorry 'bout that! <g>
I have to do this better ...

Okay, I have a message box come up in AutoOpen. It works great but it
would be really helpful to give the user more information via another
message box or two, something like this:

AutoOpen: msg box comes up with OK and CANCEL.

If user presses OK, another message pops up, different from the first.
But it also has OK and CANCEL.

If user presses OK to that one, a third and final "reminder" or
message pops up. Here it can have just an OK button as CANCEL would
be superfluous <g>.

If at any time, though, the user presses Cancel, no further message
boxes come up.

I hope I got it better this time. <g>

Oh, should mention what the above does. It just regurgitates back to
user which button was pressed. When OK was pressed, a message box
comes up saying "User selected OK". When they press cancel, another
box pops up saying "User selected cancel". Nifty, but, um, not
exactly something that I can find a user for here <vbg>.

Thanks! Much appreciated! :eek:D
 
O

OssieMac

I was assuming that you knew enough to complete your task once I had given
you the idea of vbOkCancel etc. You will need to edit your messages in the
following for your first, second third msge etc. I have also used If/Else/End
If as an alternative way of doing it.

Sub Auto_Open()
Dim MyMsgBox
Dim MyMsgBox2
Dim MyMsgBox3

MyMsgBox = MsgBox("Script line 1." & vbCrLf & _
"Script line 2", _
vbOKCancel + vbExclamation, "REMEMBER ...")

If MyMsgBox = vbOK Then
MyMsgBox2 = MsgBox("2nd msge." & vbCrLf & _
"Script line 2", _
vbOKCancel + vbExclamation, "REMEMBER ...")

If MyMsgBox2 = vbOK Then
MyMsgBox3 = MsgBox("3rd msge." & vbCrLf & _
"Script line 2", _
vbOKOnly + vbExclamation, "REMEMBER ...")
Exit Sub
Else
Exit Sub
End If
Else
Exit Sub
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top