ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   vbYesNo, change carriage return (https://www.excelbanter.com/excel-discussion-misc-queries/159922-vbyesno-change-carriage-return.html)

jbjtc

vbYesNo, change carriage return
 
Hie, can anyone help with the following:

When you create a message box using vbYesNo function, when the box appears
on screen, is it possible to change the set-up so that when you press return
(carriage return) it will automatically select the "No" option. Standard
vbYesNo defaults to "Yes" option when you hit carriage return.

Any help would be much appreciated.

Thank you
--
jj

Ron Coderre

vbYesNo, change carriage return
 
Put this macro in a General Module and run it:

Sub MsgBoxButtonTest()
MsgBox _
Title:="Default Button Test", _
Prompt:="Is this an aardvark?", _
Buttons:=vbQuestion + vbYesNo + vbDefaultButton2
End Sub

Then see Excel VBA Help for MsgBox and study the various Button argument
values.

Does that help?
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)

"jbjtc" wrote in message
...
Hie, can anyone help with the following:

When you create a message box using vbYesNo function, when the box appears
on screen, is it possible to change the set-up so that when you press
return
(carriage return) it will automatically select the "No" option. Standard
vbYesNo defaults to "Yes" option when you hit carriage return.

Any help would be much appreciated.

Thank you
--
jj




Kevin B

vbYesNo, change carriage return
 

MsgBox "Message Text", vbYesNo + vbDefaultButton2, "Titlebar Text"
--
Kevin Backmann


"jbjtc" wrote:

Hie, can anyone help with the following:

When you create a message box using vbYesNo function, when the box appears
on screen, is it possible to change the set-up so that when you press return
(carriage return) it will automatically select the "No" option. Standard
vbYesNo defaults to "Yes" option when you hit carriage return.

Any help would be much appreciated.

Thank you
--
jj


jbjtc

vbYesNo, change carriage return
 
Thanks Kevin
Thats done the trick.
--
jj


"Kevin B" wrote:


MsgBox "Message Text", vbYesNo + vbDefaultButton2, "Titlebar Text"
--
Kevin Backmann


"jbjtc" wrote:

Hie, can anyone help with the following:

When you create a message box using vbYesNo function, when the box appears
on screen, is it possible to change the set-up so that when you press return
(carriage return) it will automatically select the "No" option. Standard
vbYesNo defaults to "Yes" option when you hit carriage return.

Any help would be much appreciated.

Thank you
--
jj


jbjtc

vbYesNo, change carriage return
 
Your code works.
Thanks for your help Ron
--
jj


"Ron Coderre" wrote:

Put this macro in a General Module and run it:

Sub MsgBoxButtonTest()
MsgBox _
Title:="Default Button Test", _
Prompt:="Is this an aardvark?", _
Buttons:=vbQuestion + vbYesNo + vbDefaultButton2
End Sub

Then see Excel VBA Help for MsgBox and study the various Button argument
values.

Does that help?
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)

"jbjtc" wrote in message
...
Hie, can anyone help with the following:

When you create a message box using vbYesNo function, when the box appears
on screen, is it possible to change the set-up so that when you press
return
(carriage return) it will automatically select the "No" option. Standard
vbYesNo defaults to "Yes" option when you hit carriage return.

Any help would be much appreciated.

Thank you
--
jj






All times are GMT +1. The time now is 03:55 PM.

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