vbYesNo, change carriage return

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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)
 
Your code works.
Thanks for your help Ron
--
jj


Ron Coderre said:
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)
 
Back
Top