Figure 4-28. HRWizard class module list
Coding the HRWizard UserForm
Now that we??™ve done all the hard work, let??™s plug our objects into our HRWizard UserForm and
put those objects to work.
Open the code window for the HRWizard UserForm. Add the following module-level variable
declarations:
Dim m_oEmployee As cPerson
Dim m_oLM As cListManager
Dim m_oWizard As cStepManager
Dim m_colSteps As Collection
Although we created nine separate class modules to run our application, many are used
internally by the classes listed in our declaration section. We??™ll be using the cPerson class to
collect the data for a new employee; the cListManager to populate our various combo boxes
on the HRWizard UserForm; and the cStepManager to determine which screen to show when
and in what order, and to control the availability of the navigation command buttons. Finally,
we are using a standard VBA Collection object. This will be used to store the cStepManager
object??™s PageSettings collection.
Initializing the Application
In our HRWizard UserForm??™s Initialize event, we will initialize our custom objects and add
code to set up the wizard, lists, and display form.
Add the following code to the UserForm_Initialize event:
CHAPTER 4 n USERFORMS 178
Private Sub UserForm_Initialize()
Set m_oEmployee = New cPerson
Set m_oLM = New cListManager
Set m_oWizard = New cStepManager
InitWizard
InitLists
InitForm
End Sub
Now we??™ll create the three Init functions. These will set up our wizard, list manager, and
UserForm objects.
Pages:
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188