|
|
By default the MsgBox function of VBA will default the choise to the first button on the form. i.e M
Message = MsgBox("Update the file?", vbYesNo, """Yes"" as the default")
Will instruction would display the following message box:
This, of course, is fine if you want the default response to be "Yes", but what if you want the default to be "No"?
The answer is to use the "vbDefaultButtonn" option. The vbDefaultButton should be added to the MsgBox type (i.e vbYesNo). The n value will depend
on which button you want to make the default. To make "No" the default for the vbYesNo option you would code:
Message = MsgBox("Update the file?", vbYesNo + vbDefaultButton2, """No"" as the default")
This would reult in the following message box being displayed:
If the MsgBox option has 3 buttons and you want to make the third button the default, you would use vbDefaultButton3.
That is all there is to it. Enjoy!
| |
|
|