msgbox in macro

  • Thread starter Thread starter 00KobeBrian
  • Start date Start date
0

00KobeBrian

I am writing a msgbox in a macro which is an action. How can I make yes or
no button in this action? Thanks.
 
Hi,
you don't really need a macro for this.
You could try the following code on whatever form event you want to use:

Select Case MsgBox("Your Message Text", vbYesNo Or vbExclamation Or
vbDefaultButton1, Application.Name)
Case vbYes
'yes was clicked so do something
Case vbNo
'no was clicked so do something else
End Select

Or if you want to stick to an if then statement:

If Msgbox("Your Message Text",vbYesNo,"Your Title") = vbYes Then
'yes was clicked so do something
End If

HTH
Good luck
 
Help file for MsgBox (go to your macro, click in the "field" where MsgBox
action is shown, and press F1) will give you information about this.
 
Back
Top