Microsoft Office Tutorials and References
In Depth Information
Part 5: Manipulating Excel Objects
Creating Advanced User Forms
Each Page object is a control container, which means that you can drag multiple controls
onto each page and access them as if they were placed directly on the form. The real strength
of the MultiPage control is its ability to switch from one page to another by merely updating
the Va flue property. This means that you can prepare a Page object for each step of the wizard
and then display the Page object that corresponds to the appropriate step of the wizard.
To maneuver through the steps of the wizard, you need to add four command button controls
at the bottom of the form. Since these buttons are outside of the MultiPage control, they will
always appear on each step of the wizard. Set the captions for these buttons to Cancel , < Prev,
Next > , and Finish .
Because this wizard has three steps, you need to add a third page. Right-click over the tab
area, and select New Page from the popup menu. This will add a new Page object to the
MultiPage control. (See Figure 20-8.) Then change the caption property for each page to
Step 1 , Step 2 , and Step 3 .
Figure 20-8. Right-click over the tab area, and select New Page from the popup menu to add
a new Page to the MultiPage control.
Navigating the Pages
The four buttons at the bottom of the page are the primary tool for navigation in the wizard.
Pressing the Cancel button triggers the CommandButton1_Click event, which runs the End
statement to stop the program. Pressing the Prev or Next buttons moves the wizard to the
previous or next step, respectively. The Finish button is the only way to trigger the final
execution of the wizard.