Microsoft Office Tutorials and References
In Depth Information
Part 5: Manipulating Excel Objects
Creating Advanced User Forms
Running the Wizard
Pressing the Finish button actually runs the wizard. In this example, the wizard’s execution
consists of displaying a message box and then ending the program. In a real wizard, the MsgBox
statement would be replaced with a call to a subroutine that takes the information collected
through the various steps of the wizard and performs whatever task the wizard was designed
to perform.
Private Sub CommandButton4_Click()
MsgBox "Ending the wizard"
End
End Sub
More typically, this routine would collect information collected from the various controls on
the user form and then execute whatever function that the wizard was supposed to perform.
It’s important to remember that the user may choose to press the Finish button at any time
while the wizard is active. Therefore, it might be desirable to give each control on the wizard
a meaningful default value so that pressing the Finish button will produce a useful result.
If you choose not to give each control a meaningful value, you should examine the informa€
tion stored in the controls to determine if there is sufficient information to produce a useful
result. If a user hasn't given the wizard enough information to produce a useful result, your
verification routine should display the wizard step where the user can supply the information.
In this chapter, you saw how to build two different applications that rely on user forms. In the
first application, you saw how you can easily build a user form that allows someone to edit
the data contained in a worksheet. By providing a user form, you can insure that the data
that’s entered into the worksheet is both valid and properly formatted. In the second applica€
tion, you saw how to build a multi-step wizard with a single a user form and MultiPage con€
trol. Each Page in the MultiPage control allows you to create a custom appearance for each
step of the wizard, and using a single user form simplifies the development process.
441
Search JabSto ::




Custom Search