Controls

When a dialog box or userform is displayed to the user, the user interacts by using various controls.
The most common controls are button, option button, listbox and edit box.
It is possible to create your own custom dialog boxes by adding controls to a userform.
This section covers all the different controls which are available.
There is a different section dedicated to Userforms

ControlPrefixComments
CheckBoxchbThis control allows the user to either select or deselect an option.
Creates a box that the user can easily choose to indicate if something is true or false, or to display multiple choices when the user can choose more than one.
ComboBoxcboThis control allows the user to either select an item from the drop-down list or to enter a different value into the textbox.
Allows you to draw a combination list box and text box.
The user can either choose an item from the list or enter a value in the text box.
CommandButtonbtnThis control allows the user to perform a specific action and will run a separate subroutine.
Creates a button the user can choose to carry out a command.
DatePickerdtpThere was a built-in DateTimePicker control but unfortunately this only works with Office 32-Bit, not Office 365.
It is possible to recreate similar functionality using a combination of other controls.
This solution uses built-in controls to select and validate dates and is backwards compatible with Office 32-Bit.
FramefraThis control allows you to group other controls together, such as option buttons.
Allows you to create a graphical or functional grouping for controls.
To group controls, draw the frame first, and then draw controls inside the frame.
ImageimgThis control allows you to add a graphic or picture to a userform.
Displays a graphical image from a bitmap, icon, or metafile on your form.
Images displayed in an Image control can only be decorative and use fewer resources than a PictureBox.
LabellblThis control allows you to display text to the user. This is normally only to display descriptive text.
Allows you to have text that you do not want the user to change, such as a caption under a graphic.
ListBoxlsbThis control allows the user to select from a list of possible choices.
Use to display a list of items from which the user can choose.
The list can be scrolled if it has more items than can be displayed at one time.
ListViewlsvThis control allows the user to select from a list of possible choices.
MonthViewmnvThis control allows the user to select a date (or time) using a large date control.
MultiPagemlpThis control can be used to create a dialog box containing several tabs, allowing the user to switch between them.
Presents multiple screens of information as a single set.
OptionButtonoptThis control allows the user to select from a list of possible choices.
Allows you to display multiple choices from which the user can choose only one.
ProgressBarprgThis control indicates the progress of an action by displaying a horizontal bar.
RefEditrefThis control allows the user to select a range of cells in Excel.
ScrollBarscrThis control allows the user to drag a button in order to select a value.
Provides a graphical tool for quickly navigating through a long list of items or a large amount of information, for indicating the current position on a scale, or as an input device or indicator of speed or quantity.
SpinButtonspnThis control allows the user to select a value by clicking on two buttons either to increase or decrease the value.
A spinner control you can use with another control to increment and decrement numbers. You can also use it to scroll back and forth through a range of values or a list of items.
TabStriptabThis control allows you to create several tabs of the same controls.
Allows you to define multiple pages for the same area of a window or dialog box in your application.
TextBoxtxtThis control allows you to display text and to allow the user to enter information.
Holds text that the user can either enter or change.
ToggleButtontogThis control allows the user to toggle between two states.
Creates a button that toggles on and off.
TreeViewtrvThis control displays a hierarchical list of items by using collapsible nodes.
WebBrowserwbrThis control allows the user to display a web page.

Control Names

These names are used in the event procedures and can also be used in other parts of the program it is a good idea to give your controls meaningful names before adding the event handlers.
To change the name of the control, open the Property window and edit the field "Name"
A popular naming technique is to use a three letter prefix to identify the type of the control. The remaining letters should describe the purpose of the control or should relate to the data that the control will hold.


ControlTip

There is a ControlTipText property that can be used to display a tooltip when the mouse hovers over the control.

TextBox1.ControlTipText = "" 
CommandButton1.ControlTipText = ""
ComboBox1.ControlTipText = ""

Setting Focus to a particular control

This cannot be done in the Load event and must be done in the Activate event

txtTextBox.SetFocus() 

Positioning

You cannot undo your changes
Make sure you export a copy of the userform before trying to align your controls


A userform may contain horizontal and vertical grid lines to help you align the controls
When you add or move a control it "snaps" to the grid to help you line up the controls.
This option can be switched off (Tools > Options)(General tan, "Form Grid").


The Format menu provides several commands to help you align and position the controls precisely.
SS
Also helps you to space the controls evenly.


When you select multiple controls the last control appears with white handles rather than black.
The control with the white handles is used as the model against which the controls with black handles are compared to.


Aligning



© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopNext