The MsgBox I created in VBA using MsgBox function has two buttons, 'Yes' and 'No'. The default is 'Yes' when the user presses the enter key. How do I change the default to 'No'?
In the code for the message box, the second parameter is for setting number of buttons, whether an icon is displayed (STOP, Question Mark etc) and which button is the default one. You can add these together so you will get something like:
Code:
Response = msgbox("Do you want to continue?", vbYesNo + vbQuestion + vbDefault2)
This will set the second button as the default one. Alex Middleton
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.