This tutorial gives you an overview of what a UserForm Control is and how to add them to your form.
Adding a Control to a UserForm
List of Controls for UserForms
Controls are the things that you see on a UserForm; they are the buttons, the text, the input areas, the tabs, and so on. Controls are the building blocks of the UserForm.
Without any Controls, the UserForm would just be a gray square with nothing on it.
To make a UserForm do much of anything, we have to add a Control to it. In this section, I'll show you how to add, edit, and manage controls.
Make sure the UserForm is visible.
Go to the VBA window (Alt + F11) and double-click the UserForm from the Project window on the left side of the screen - if you don't see the Project window, hit Ctrl + R and it will appear.
Click the UserForm and make sure that Toolbox appears; it's a small box that contains the Controls for the UserForm. If you don't see it, go to View > Toolbox and it will appear.
From the Toolbox, click the control that you want to add.
Let's add a simple Label.
Click the button for the Label in the Toolbox and then move your mouse over the UserForm and click and drag the mouse over where you want the item to appear.
When you release the mouse button, the Control will appear.
Now, you have a new item in your UserForm.
To change the size of it, simple select the desired Control and click the white blocks around the edges and drag the mouse until you have the desired size.
To move the Control, click the edge of it and drag it around the UserForm.
The Properties window is where you find everything that defines a Control. To view it, first select the Control and look to the left side of the VBA window.
If the Properties window doesn't appear, hit F4 to show it.
There, you can change the name of the Control, which is used to reference it with macros, the text displayed in the Control, the appearance of the displayed text, if the Control is even visible, and much more.
These are the most often used properties for Controls:
(Name) - the name of the Control that you will use in VBA in order to do something with it. For instance, you need to know the name of a TextBox in order to get the user's input from it.
Caption - the text that will appear in or on the Control. For a button, this is what appears as the button's text; for a Label, this is the text that appears within the label.
Font - click this section and then the button with the 3 dots that appears and you can control the size and appearance of the text within the Control.
There are many other options that you can change for a Control, and those will be covered in more depth in another tutorial.
To remove a Control, simply click it and hit the Delete key or Right-click it and select Delete.
You can always hit Ctrl + Z to undo the deletion if you made a mistake.
The most common Controls are the Label, CommandButton, TextBox, and CheckBox.
Here is what they might look like on the UserForm.
In the VBA window in design mode, it looks like this:
This is a list of all of the Controls that you can add to a UserForm.
(eventually, each Control will have a link to its own tutorial)
Controls are what make a UserForm useful. This tutorial is supposed to serve as an introduction to these Controls. I recommend that you play around with them and see what works best for your situation.
In later tutorials, you will learn how to do things with these controls, such as get data from them and put data into them.
Make sure to download the sample file to see these examples in Excel. However, in this case, the UserForm will not actually do anything; it simply illustrates the display of a few Controls.