Microsoft Office Tutorials and References
In Depth Information
When you add a new control, it’s assigned a name that combines the control type with the
numeric sequence for that type of control. For example, if you add a CommandButton control to
an empty UserForm, it’s named CommandButton1 . If you then add a second CommandButton
control, it’s named CommandButton2 .
Renaming all the controls that you’ll be manipulating with your VBA code is a good
idea. Doing so lets you refer to meaningful names (such as ProductListBox ) rather
than generic names (such as ListBox1 ). To change the name of a control, use the
Properties window in the VBE. Just select the object and change the Name property.
In the sections that follow, I briefly describe the controls available to you in the Toolbox.
Figure 13-3 shows a UserForm with one of each control. This workbook, named all
userform controls.xlsm , is available on the companion CD-ROM.
Figure 13-3: This UserForm has one of each of the 15 controls.