Microsoft Office Tutorials and References
In Depth Information
Part 5: Manipulating Excel Objects
Creating Advanced User Forms
Tip Double-Click to Save Time
If you wish add multiple copies of the same control to a user form, double-click the control
in the toolbox. The mouse pointer will change to reflect the selected control. You may then
draw multiple controls on the user form. When you’re finished adding that particular control,
you may double-click another control in the toolbox to add multiple copies of that control or
click the arrow in the toolbox to return the mouse pointer to normal.
Use the Properties window to change the Name property of each text box to reflect the
database fields ( CustomerId , CustomerName , City , ZipCode , and DateAdded ).
Change the Name property of the combo box control to State . Also change the Cap
tion property for each Label control to something more descriptive. (See Figure 20-2.)
Figure 20-2. Add TextBox and Label controls for each column in the worksheet
and their properties as directed.
Add CommandButton controls to the user form that will allow the user to scroll
through the rows. Change the Caption property to read First , Previous , Next , and
Last . Leave a space between the Previous and Next controls.
Tip Controls Have Freedom of Movement
Once a control is on the form, you can select it and move it anywhere on the form you wish.
You can also do the same thing with multiple controls by clicking the form and dragging to
select the group of controls you want to move. Then you can drag the selected group around
on the form.
Add a Te xtBox control in between the Previous and Next controls. Change the Name
property to RowNumber . Set the Te xt property to . 2