Microsoft Office Tutorials and References
In Depth Information
Adding Controls to a UserForm
For the workbook’s first UserForm, VBA assigns a default value of “UserForm1” to its Name
and Caption properties, as you can see in Figure 18-5. If you were to create a second UserForm,
its default Name and Caption properties would be “UserForm2,” and so on. To help distinguish
between the Name and Caption properties, Figure 18-6 shows where the Name property was
changed to “frmEmployees,” and the Caption property, which is displayed in the UserForm’s title
bar, was changed to “Employee Information.”
figurE 18-6
When naming UserForms, or any object for that matter, it’s best to assign a name
that is relevant to the theme of the object. When I name a UserForm, I use the
prefix “frm” (for UserForm) followed by a simple, intuitive term (such as “Employees”
in this example) that represents the basic idea of the UserForm object.
Adding conTrols To A usErforM
A control is an object such as a Label, TextBox, OptionButton, or CheckBox, in a UserForm or
embedded onto a worksheet that allows users to view or manipulate information. VBA supports
these and more controls, which are accessible to you from the VBE Toolbox. To show the Toolbox
so you can easily grab whatever controls you want from it, you can click the Toolbox icon, or click
View Toolbox as shown in Figure 18-7.
Search JabSto ::

Custom Search