Msgbox Yes No

I have a yes/no msgbox - I want different actions to happen dependant on the click of yes or no - how do I go about this ?
LVL 4
Carl2002Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
NatchiketConnect With a Mentor Commented:
Assuming you are using VBA

If Msgbox("Message",vbQuestion+vbYesNo,"Title bar") = vbYes Then
  'Yes click actions
Else
  'No click actions
End IF
0
 
bluelizardConnect With a Mentor Commented:
when you call msgbox, the returned value is the button that was clicked:

if msgbox("do you want such and such?", vbyesno) = vbyes then
  ' user clicked yes: do yes stuff
else
  ' user clicked no: do no stuff
end if


--bluelizard
0
 
bluelizardCommented:
tie! ... well, anyway, we seem to agree...! ;-)
0
 
NatchiketCommented:
vbYes
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.