UserForm Builder

UserForms are customizable forms that can be used to convey or receive information to/from a user.

The UserForm builder makes it much easier to create well-designed UserForms. As you create your UserForm, you can see a preview of the form to the right of the UserForm Builder:

The OK and Cancel buttons are automatically added to forms with the Cancel button closing the form.

UserForm Builder – How To

First, Go to the UI menu and select UserForm Builder.

Adding UserForm Controls

UserForms consist of controls. To add a control, select a Control Type.

Initial Value

After updating the Name and Caption, set the Initial Value of the control(if necessary).

The Initial Value can be manually inputted, or it can rely on a range of cells (so that the UserForm populates values based on values in the spreadsheet that can be easily adjusted).

Output Value

When the form is closed, the values are of the control can be recorded to a VBA variable, or outputted to a range (AutoMacro will automatically add this code to the UserForm).

Form Size and Display Options

Form Size

By setting Auto Height, the height of the form will automatically adjust to fit all the controls.

Or you can manually define the Height and Width.

Display Options

  • Auto-Location – When checked, VBA will determine where the form displays
  • Modeless – When checked, the form will display, but you can still interact with Excel or other forms. Additionally, VBA code will continue running after the form is displayed.
  • Center on Screen – Centers the form in the middle of the screen (only available if Auto-Location is unchecked)
  • Left / Top – Set the form’s position on the screen (only available if Auto-Location is unchecked)

Formatting

In addition, to VBA’s default UserForm style, you can also select the Excel Online UI style for a more modern interface:

Or, set a custom style. Allowing you to manually set fonts and colors.

Control Formatting

To set colors for your controls, simply select the control(s) and then apply the appropriate colors. In addition to the standard colors, AutoMacro also gives you the ability to set a “hover color”.

Viewing the UserForm

Once you’re done designing the UserForm, click Create and you’ll see that the UserForm has been added to your VBA project:

userform final form

Click on the UserForm to edit it.

vba view userform code

Or right-click and select View Code to edit the code:

vba userform code

Here you can see the code that AutoMacro has automatically added to the UserForm.

Open the UserForm with Macro

Last, follow the instructions here: to create a clickable button to open the UserForm.

< Previous

Class & Property Builders

Next >

SelectBox Builder

Start Automating Excel

automacro