ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Default Response to a MsgBox (https://www.excelbanter.com/excel-programming/315217-default-response-msgbox.html)

Fred Holmes

Default Response to a MsgBox
 
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????

KL[_5_]

Default Response to a MsgBox
 
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


"Fred Holmes" wrote in message
...
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????




Andy Pope

Default Response to a MsgBox
 
Hi Fred,

You can combine the Button parameters.

MsgBox "test", vbYesNoCancel Or vbDefaultButton2

Cheers
Andy

Fred Holmes wrote:

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????


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


All times are GMT +1. The time now is 05:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com