Default Response to a MsgBox

  • Thread starter Thread starter Fred Holmes
  • Start date Start date
F

Fred Holmes

Excel 2003

I have a message box with Buttons:=vbYesNoCancel

The default response (button with focus -- executed by <Enter>) is
"Yes". How do I change it so that the default response is "No"?


There is no option for Buttons:=vbNoYesCancel

There doesn't seem to be any explicit parameter that provides for the
developer to select the default response????
 
Try this:

MsgBox "Are you sure?", vbDefaultButton1 + vbOKCancel, "Default Option"
MsgBox "Are you sure?", vbDefaultButton2 + vbOKCancel, "Default Option"

or this:

MsgBox "Are you sure?", vbDefaultButton1 + vbYesNoCancel, "Default Option"
MsgBox "Are you sure?", vbDefaultButton2 + vbYesNoCancel, "Default Option"
MsgBox "Are you sure?", vbDefaultButton3 + vbYesNoCancel, "Default Option"

Cheers,
KL
 
Hi Fred,

You can combine the Button parameters.

MsgBox "test", vbYesNoCancel Or vbDefaultButton2

Cheers
Andy
 

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

Back
Top