How to Customize Button Text in an Access VBA Message Box
Question details
The user wants to change the default button labels (such as Yes, No, Cancel) on a standard VBA message box to custom text.

- Product
- Microsoft Access / Office VBA
- Device & OS
- not provided
- Scenario
- Creating a VBA macro that requires specific user decisions (e.g., 'Approve' or 'Reject') rather than generic Yes/No responses.
- Observed behavior
- The standard VBA MsgBox function uses fixed button labels based on system defaults and does not provide a native parameter to apply custom captions.
Before attempting to customize message box buttons, ensure your VBA environment is set up and that you have permissions to insert UserForms or import third-party modules into your project.
Create a Custom UserForm to Replace MsgBox
Since the built-in MsgBox function cannot be directly modified, building a custom UserForm is the most reliable and native way to display custom button text.
A UserForm allows you to completely design the dialogue box from scratch. You can add your own labels, customize the appearance, and define exactly what each button says and does.
Open the VBA Editor by pressing ALT + F11. Go to the top menu, click 'Insert', and select 'UserForm'.
Use the Toolbox to drag and drop a 'Label' onto the form for your main message text. Adjust the font and size in the Properties Window.
Drag 'CommandButton' controls onto the form for each option. Select each button, navigate to the Properties Window, and change the 'Caption' property to your custom text (e.g., 'Approve', 'Review').
Double-click each button to access its code. Write the necessary VBA logic to handle the user's choice, ending with 'Unload Me' to close the custom dialogue box.
In your main macro, replace the standard MsgBox call with 'UserFormName.Show' to display your custom interactive prompt.

Use an Enhanced Message Box Module
Utilize a trusted community-built VBA module that uses Windows API functions to dynamically rename the buttons on a standard message box.
Try WPS Office for Your Spreadsheet and Macro Needs
While Microsoft Access is part of a paid subscription, WPS Office provides a powerful, free alternative for your daily document and spreadsheet tasks. WPS Spreadsheet comes equipped with robust VBA support, allowing you to run macros and customize UserForms easily.

Frequently Asked Questions
Why can't I pass custom names directly to the standard VBA MsgBox?
The standard VBA MsgBox is a direct wrapper for the core Windows OS message dialogue. Because it relies on predefined system templates (like vbYesNoCancel), it does not expose any parameters for custom string arrays or labels.
Can I use Windows API hooks to change MsgBox text without a UserForm?
Yes, advanced VBA developers can use Windows API functions (such as SetWindowsHookEx) to intercept the dialogue box as it is created and overwrite the button text. However, this method is highly complex and can cause Excel or Access to crash if not coded perfectly.
Does WPS Spreadsheet support VBA UserForms?
Yes, WPS Spreadsheet has robust support for VBA macros, including the ability to insert, design, and run UserForms. This allows you to easily create custom message boxes directly within WPS Office.




