How do I Exit a vbYesNo Msgbox?

When I run my program, and when my msgbox ask for my response, it never exits without an alt,clt, delete. How would I make this work?



TIMBO





Message Box #1

MsgBox "Set NACT to 3600?", vbYesNo, "Valid Data"

If MsgBox("Valid Data") = True Then

vsbMiddle.Value = 3600

Else

vsbMiddle.Value = middlevAlue

End If







Message Box #2

If MsgBox ("Set NACT to 3600?", vbYesNo, "Valid Data") = vbYes Then

vsbMiddle.Value = 3600

Else

vsbMiddle.Value = middlevAlue

End If



Try both and see for yourself.




Comments

  • no problem with your second code at all, unless it's in a do-loop block.



    (i know exactly your feeling when all the magical things go with you, and you only. this happens with me!)



    Sam -/-



    : When I run my program, and when my msgbox ask for my response, it never exits without an alt,clt, delete. How would I make this work?

    :

    : TIMBO

    :

    :

    : Message Box #1

    : MsgBox "Set NACT to 3600?", vbYesNo, "Valid Data"

    : If MsgBox("Valid Data") = True Then

    : vsbMiddle.Value = 3600

    : Else

    : vsbMiddle.Value = middlevAlue

    : End If

    :

    :

    :

    : Message Box #2

    : If MsgBox ("Set NACT to 3600?", vbYesNo, "Valid Data") = vbYes Then

    : vsbMiddle.Value = 3600

    : Else

    : vsbMiddle.Value = middlevAlue

    : End If

    :

    : Try both and see for yourself.

    :

    :






  • Sam, It does not Work. It keeps looping.



    Thanks,



    Timbo :)



    : no problem with your second code at all, unless it's in a do-loop block.

    :

    : (i know exactly your feeling when all the magical things go with you, and you only. this happens with me!)

    :

    : Sam -/-

    :

    : : When I run my program, and when my msgbox ask for my response, it never exits without an alt,clt, delete. How would I make this work?

    : :

    : : TIMBO

    : :

    : :

    : : Message Box #1

    : : MsgBox "Set NACT to 3600?", vbYesNo, "Valid Data"

    : : If MsgBox("Valid Data") = True Then

    : : vsbMiddle.Value = 3600

    : : Else

    : : vsbMiddle.Value = middlevAlue

    : : End If

    : :

    : :

    : :

    : : Message Box #2

    : : If MsgBox ("Set NACT to 3600?", vbYesNo, "Valid Data") = vbYes Then

    : : vsbMiddle.Value = 3600

    : : Else

    : : vsbMiddle.Value = middlevAlue

    : : End If

    : :

    : : Try both and see for yourself.

    : :

    : :

    :

    :

    :








  • That sounds as though its in some kind of loop. Either the Do-loop, or For-Loop.



    You need to use the what ever the code is to exit the loop



    Exit For



    or



    Exit Loop (Might be Exit Do) 'I can't recall the exact code for exiting a Do loop.



    : Sam, It does not Work. It keeps looping.

    :

    : Thanks,

    :

    : Timbo :)

    :

    : : no problem with your second code at all, unless it's in a do-loop block.

    : :

    : : (i know exactly your feeling when all the magical things go with you, and you only. this happens with me!)

    : :

    : : Sam -/-

    : :

    : : : When I run my program, and when my msgbox ask for my response, it never exits without an alt,clt, delete. How would I make this work?

    : : :

    : : : TIMBO

    : : :

    : : :

    : : : Message Box #1

    : : : MsgBox "Set NACT to 3600?", vbYesNo, "Valid Data"

    : : : If MsgBox("Valid Data") = True Then

    : : : vsbMiddle.Value = 3600

    : : : Else

    : : : vsbMiddle.Value = middlevAlue

    : : : End If

    : : :

    : : :

    : : :

    : : : Message Box #2

    : : : If MsgBox ("Set NACT to 3600?", vbYesNo, "Valid Data") = vbYes Then

    : : : vsbMiddle.Value = 3600

    : : : Else

    : : : vsbMiddle.Value = middlevAlue

    : : : End If

    : : :

    : : : Try both and see for yourself.

    : : :

    : : :

    : :

    : :

    : :

    :

    :

    :






  • : When I run my program, and when my msgbox ask for my response, it never exits without an alt,clt, delete. How would I make this work?

    :

    : TIMBO

    :

    :

    : Message Box #1

    : MsgBox "Set NACT to 3600?", vbYesNo, "Valid Data"

    : If MsgBox("Valid Data") = True Then

    : vsbMiddle.Value = 3600

    : Else

    : vsbMiddle.Value = middlevAlue

    : End If

    :

    :

    :

    : Message Box #2

    : If MsgBox ("Set NACT to 3600?", vbYesNo, "Valid Data") = vbYes Then

    : vsbMiddle.Value = 3600

    : Else

    : vsbMiddle.Value = middlevAlue

    : End If

    :

    : Try both and see for yourself.

    :

    :



    Try this:

    Ret = MsgBox ("Set NACT to 3600?", vbYesNo, "Valid Data")

    If (Ret = vbYes) Then

    vsbMiddle.Value = 3600

    Else

    vsbMiddle.Value = middlevAlue

    End If




  • Thanks Mr. J,



    You saved the day. It works perfectly.



    Timbo









    : : When I run my program, and when my msgbox ask for my response, it never exits without an alt,clt, delete. How would I make this work?

    : :

    : : TIMBO

    : :

    : :

    : : Message Box #1

    : : MsgBox "Set NACT to 3600?", vbYesNo, "Valid Data"

    : : If MsgBox("Valid Data") = True Then

    : : vsbMiddle.Value = 3600

    : : Else

    : : vsbMiddle.Value = middlevAlue

    : : End If

    : :

    : :

    : :

    : : Message Box #2

    : : If MsgBox ("Set NACT to 3600?", vbYesNo, "Valid Data") = vbYes Then

    : : vsbMiddle.Value = 3600

    : : Else

    : : vsbMiddle.Value = middlevAlue

    : : End If

    : :

    : : Try both and see for yourself.

    : :

    : :

    :

    : Try this:

    : Ret = MsgBox ("Set NACT to 3600?", vbYesNo, "Valid Data")

    : If (Ret = vbYes) Then

    : vsbMiddle.Value = 3600

    : Else

    : vsbMiddle.Value = middlevAlue

    : End If

    :

    :






Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories