Microsoft Office Tutorials and References
In Depth Information
Creating Wizards
Setting up the MultiPage control for the wizard
Start with a new UserForm and add a MultiPage control. By default, this control contains two
pages. Right-click the MultiPage tab and insert enough new pages to handle your wizard (one
page for each wizard step). The example on the CD-ROM is a four-step wizard, so the
MultiPage control has four pages. The captions of the MultiPage tabs are irrelevant because
they won’t be seen. The MultiPage control’s Style property will eventually be set to 2 -
fmTabStyleNone .
While working on the UserForm, you’ll want to keep the MultiPage tabs visible to
make it easier to access various pages.
Next, add the desired controls to each page of the MultiPage control. These controls will, of
course, vary depending on your application. You may need to resize the MultiPage control
while you work in order to have room for the controls.
Adding the buttons to the wizard’s UserForm
Now add the buttons that control the progress of the wizard. These buttons are placed outside
the MultiPage control because they’re used while any of the pages are displayed. Most wizards
have four buttons:
h Cancel: Cancels the wizard and performs no action.
h Back: Returns to the previous step. During Step 1 of the wizard, this button should be
disabled.
h Next: Advances to the next step. During the last wizard step, this button should be
disabled.
h Finish: Finishes the wizard.
In some cases, the user is allowed to click the Finish button at any time and accept the
defaults for items that were skipped over. In other cases, the wizard requires a user
response for some items. If this is the case, the Finish button is disabled until all
required input is made. The example on the CD-ROM requires an entry in the TextBox in
Step 1.
In the example, these CommandButtons are named CancelButton , BackButton ,
NextButton , and FinishButton .
Programming the wizard’s buttons
Each of the four wizard buttons requires a procedure to handle its Click event. The event
handler for the CancelButton control follows. This procedure uses a MsgBox function (see Figure
 
Search JabSto ::




Custom Search