Initializing the Wizard
Add a new subroutine to the UserForm code window and name it InitWizard. Add the following
code:
Private Sub InitWizard()
With m_oWizard
Set .Worksheet = Sheets("UFormConfig")
.NumberOfSettings = 3
Set m_colSteps = .PageSettings
Set .PreviousButton = Me.cmdPrevious
Set .NextButton = Me.cmdNext
.CurrentPage = MultiPage1.Value + 1
End With
End Sub
This simple procedure does the following:
??? Tells the cStepManager object where to find the configuration data
Set .Worksheet = Sheets("UFormConfig")
??? Tells the cStepManager object how many columns to retrieve data from
.NumberOfSettings = 3
??? Puts the page settings into a collection
Set m_colSteps = .PageSettings
??? Sets the navigation buttons
Set .PreviousButton = Me.cmdPrevious
Set .NextButton = Me.cmdNext
??? Sets the current page
.CurrentPage = MultiPage1.Value + 1
CHAPTER 4 n USERFORMS 179
We are using the MultiPage control??™s Value property plus 1 to set the CurrentPage property
because the MultiPage control??™s Page collection is zero-based. (Normally, collections are onebased,
and I??™m not sure why this collection is different, but that??™s the way it is.)
The cStepManager object must be set up before we initialize the form because the form
will use the PageSettings collection to set itself up.
Initializing the Combo Boxes
The next step is to bind our combo boxes to their respective lists. The lists are stored on the
ListMgr worksheet.
Add a new subroutine and name it InitLists.
Pages:
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189