How to Left-Align an Excel VBA UserForm CommandButton Caption
Question details
The user wants to left-align the text (caption) inside a CommandButton on an Excel VBA UserForm.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Designing a custom UserForm using VBA and trying to customize the appearance of a CommandButton by left-aligning its text.
- Observed behavior
- The CommandButton caption remains centered by default, and there is no native TextAlign or Alignment property available to change it to left-aligned.
Ensure you have access to the VBA editor (Developer tab) and have your UserForm open in Design Mode before attempting these layout adjustments.
Use a Label Control as a Workaround
Since CommandButtons lack a text alignment property, you can use a Label control layered over the button to display left-aligned text.
By default, VBA CommandButtons always center their captions. The HorizontalAlignment property only applies to worksheet cells, and the Left property moves the entire button, not the text.
To achieve a left-aligned appearance, you can clear the button's caption and place a transparent Label control with left-aligned text directly over it.
Press Alt + F11 to open the VBA Editor, then double-click your UserForm in the Project Explorer to open it in Design Mode.
Select your CommandButton, go to the Properties window (F4), and delete the text in the 'Caption' field.
From the Toolbox, select the 'Label' control and draw it directly over the CommandButton.
In the Label's Properties window, change the 'BackStyle' property to '0 - fmBackStyleTransparent'.
Set the Label's 'Caption' to your desired text and change its 'TextAlign' property to '1 - fmTextAlignLeft'.
Double-click the Label to access its code module, and call your CommandButton's click macro from within the Label_Click event so the button still works when the text is clicked.

Redesign UserForm Layout and Button Aesthetics
Adjust the design of your UserForm to accommodate centered button text instead of using complex overlays.
Try WPS Office for Your Spreadsheet and Macro Needs
While VBA UserForm limitations like button text alignment affect all standard spreadsheet software, WPS Office provides a lightweight, highly compatible, and free alternative to Microsoft Office. It fully supports VBA macros, ensuring your existing Excel projects run smoothly.
- 1. Download and Install: Visit the official WPS website and download the free installer for WPS Office.
- 2. Open Your Macro File: Launch WPS Spreadsheet and open your existing .xlsm files.
- 3. Enable Macros: Click 'Enable Macros' when prompted by the security warning to run your VBA scripts seamlessly.

Frequently Asked Questions
Does the HorizontalAlignment property work on CommandButtons?
No, the HorizontalAlignment property is specifically designed for aligning content inside worksheet cells or ranges. It does not apply to UserForm CommandButtons.
Can I use the Left property to align text inside the button?
No, modifying the Left property of a CommandButton moves the entire control across the UserForm canvas. It does not change the internal alignment of the caption text.
Is there any native property in VBA to left-align a CommandButton caption?
Unfortunately, standard Excel VBA CommandButtons do not possess a TextAlign or Alignment property for their captions. The text is inherently centered by default.
Will a Label overlay interfere with clicking the button?
Yes, clicking the transparent Label will trigger the Label's click event rather than the button's. To resolve this, you must write a brief VBA script calling the CommandButton's click macro from within the Label's click event.




