Microsoft Office Tutorials and References
In Depth Information
A TabStrip control is similar to a MultiPage control, but it’s not as easy to use. A TabStrip
control, unlike a MultiPage control, doesn’t serve as a container for other objects. Generally,
you’ll find that the MultiPage control is much more versatile.
A TextBox control lets the user type text or a value.
Using controls on a worksheet
You can embed many of the UserForm controls directly into a worksheet. You can access these
controls by using Excel’s Developer➜Controls➜Insert command. Adding such controls to a
worksheet requires much less effort than creating a UserForm. In addition, you may not have to
create any macros because you can link a control to a worksheet cell. For example, if you insert
a CheckBox control on a worksheet, you can link it to a particular cell by setting its
LinkedCell property. When the CheckBox is checked, the linked cell displays TRUE . When the
CheckBox is unchecked, the linked cell displays FALSE .
The accompanying figure shows a worksheet that contains some ActiveX controls. This
workbook, named activex worksheet controls.xlsx , is available on the companion
CD-ROM. The workbook uses linked cells and contains no macros.
Adding controls to a worksheet can be a bit confusing because controls can come from two
● Form controls: These controls are insertable objects.
● ActiveX controls: These controls are a subset of those that are available for use on
You can use the controls from either of these sources, but it’s important that you understand the
distinctions between them. The Form controls work much differently than the ActiveX controls.
When you add an ActiveX control to a worksheet, Excel goes into design mode. In this mode,
you can adjust the properties of any controls on your worksheet, add or edit event-handler
procedures for the control, or change its size or position. To display the Properties window for an
ActiveX control, use the Developer➜Controls➜Properties command.
For simple buttons, I often use the Button control from the Form controls because it lets me
attach any macro to it. If I use a CommandButton control from the ActiveX controls, clicking it
will execute its event-handler procedure (for example, CommandButton1_Click ) in the code
module for the Sheet object — you can’t attach just any macro to it.
When Excel is in design mode, you can’t try out the controls. To test the controls, you must exit
design mode by clicking the Developer➜Controls➜Design mode button (which is a toggle).