I need to access the value of a VbYesNo msgbox

arage

Registered User.
Local time
Today, 00:36
Joined
Dec 30, 2000
Messages
537
I need to access the value of a VbYesNo msgbox, how would I code this in vba?
 
I hope I understand your question.
Below is and example of an If statement that includes a MsgBox within it that allows you to do what ever you need based on the choice from the MsgBox using Yes/No choices.

If MsgBox("Your Message Here", vbYesNo, "Your Message Title") = vbYes Then
'Code Here if "Yes" is chosen
Else
'Code Here if "No" is chosen
End If

HTH
RDH

[This message has been edited by R. Hicks (edited 05-25-2001).]
 
yup that's it thanks!
 
This is a very simple way, do you need something more then this:

Dim intAnswer As Integer

intAnswer = MsgBox("Answer yes or no", vbYesNo, "Question")

If intAnswer = vbYes Then
MsgBox "You chose yes"
Else
MsgBox "You chose no"
End If
 
Oops sorry, we all must of been posting at the same time.
 
You are welcome arage .... :-)

Talismanic, how have you been my friend?
You need to be a little "Quicker on the Draw" .. ;-)

RDH
 

Users who are viewing this thread

Back
Top Bottom