Loop back to Case vbNo '#2

R

ryguy7272

I am stuck on what I think is a loop, or may be some kind of function that
calls a certain part of the program. Basically, I am trying to figure out
how to move from Case vbNo '#3 to Case vbNo '#2. Below is my code. Can
anyone offer a suggestion as to how to get from #3 to #2? I'm thinking it is
a loop because if a user selects 'No' two times in a row, this sequence would
be looped through two times (although there is really no point in that, that
would be the logic).

YesNo = MsgBox("Has Firm been provided with, or been advised of the
existence of a legal opinion?", vbYesNo, "Warning")
Select Case YesNo
Case vbYes
'If answer is Yes, no additional action needs to be taken...
Unload UserForm47
UserForm49.Show
Case vbNo '#1
'Insert your code here if No is clicked
YesNo = MsgBox("Does the level of the opinion rise to a 'should
level'?", vbYesNo, "Warning")
Select Case YesNo
Case vbYes
MsgBox "The level of opinion is SHOULD LEVEL!!"

Case vbNo '#2
YesNo = MsgBox("You answered no. Are you sure?", vbYesNo,
"Warning")
Select Case YesNo

Case vbYes
UserForm55.Show
Unload UserForm47

Case vbNo ‘#3
'loop back to Case vbNo '#2...directly above...


End Select
End Select
End Select



Regards,
Ryan--
 
B

Bob Phillips

Why? You should handle a separate MsgBox separately. You could get yourself
into a loop if they keep saying No otherwise.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
R

ryguy7272

I don't necessarily think a 'No Loop' would be bad...it's not like the user
would enter a perpetual loop and lose control and then have to hit
Ctrl+Break. I think, at worst, a user may click the 'No' button on the
Message Box, a couple of times. I don't think anyone would continuously
click "No' over and over again, essentially saying, "I am not sure", "I am
not sure", "I am not sure"... Out of curiosity, could someone show me how
this would be done? Can someone show me how to move from Case vbNo '#3 to
Case vbNo '#2?

Regards,
Ryan---
 
S

Susan

imho, i would not use a case select structure here, because you're
only dealing with three (i think) very small commands. i think you'd
do better with a simple if then structure.

if message1 = vb yes then
go ahead & do your stuff
else
msgbox don't do that!
exit sub
end if

:)
susan
 
R

ryguy7272

Thanks for pointing me in that direction Susan. I went with this:

....blah, blah, blah...
Case vbNo '#3
MsgBox "You answered no. Please start again!!"
Exit Sub


Out of curiosity, can the thing I proposed be done? Can a msgbox be named
or somehow identified and then referenced in some sort of loop or sequence?

Cordially,
Ryan---
 
S

Susan

i'm glad you got it working! i don't think what you proposed can be
done using microsoft messageboxes. however, you could easily do it
using USERFORMS that you have designed (very cleverly) to look exactly
like a microsoft messagebox. the userforms would be called in
sequence and would be numbered or named.
:)
i think i might try that (just as a test).
susan


Thanks for pointing me in that direction Susan. I went with this:

...blah, blah, blah...
Case vbNo '#3
MsgBox "You answered no. Please start again!!"
Exit Sub

Out of curiosity, can the thing I proposed be done? Can a msgbox be named
or somehow identified and then referenced in some sort of loop or sequence?

Cordially,
Ryan---
<snip>
 
R

ryguy7272

Ah! Very clever Susan!! This DG never ceases to amaze me. In fact, it is
only a rare occasion that I am amazed less than ten times per day by the
information posted here.
 

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