VBA: button change font size

VBA - Visual Basic for Application

With VBA many things can be automated under Microsoft Office applications. Among other things, forms can be created with the Visual Basic Editor, with which you can query and process user interactions. Such UserForms always need at least one button (CommandButton) to trigger an action or event. Sometimes you have to adjust the font size of the button (CommandButton) for space or design reasons.

Screenshot of different font sizes in the CommandButton of a VBA UserForm
Using different font sizes on VBA button

Unfortunately, this is not immediately obvious in the Visual Basic Editor, since you cannot find the property “FontSize” in the Properties-Window. Instead you have to go to the property “Font” in the properties-window and click on the button with the three dots “…”.

If the properties window is not displayed, you can display it by pressing the F4 key or selecting View => Properties Window.

Screenshot VBA Editor property set font
Click the button with three dots at the “Font” property

Now you get a dialog for the font, under which you can set all the properties of a font, including the font size (Size).

VBA Editor: Screenshot Dialag Font: Set font size
Set font size in the font dialog

Thus it is possible to change the font size of the CommandButton but also generally the font size in the VBA form.

Leave a Reply

Your email address will not be published. Required fields are marked *