SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 179 | Next

Jim DeMarco

"Pro Excel 2007 VBA"

When setting a MultiPage control??™s Value
property, you are activating the page with a corresponding value. In this case, the value is 1.
Then we are calling the m_oWizard object??™s HandleControls method to initialize the navigation
buttons to their correct settings:
m_oWizard.HandleControls
Next, we hide all the pages except the first page:
iPageCount = MultiPage1.Pages.Count
For i = 1 To iPageCount - 1
MultiPage1.Pages(i).Visible = False
Next
Remember that the MultiPage control??™s Page collection is zero-based, so by starting our
loop counter at 1, we keep that page visible.
At this point, you should be able to run the form.
1. In the VBE, double-click the form in the Project Explorer window.
2. Click the Run button on the Standard toolbar or press the F5 function key, as shown in
Figure 4-29.
Figure 4-29. The Run Sub/UserForm toolbar button
Notice in Figure 4-30 that the caption appears in the tab handle and the Previous
command button is disabled.
CHAPTER 4 n USERFORMS 181
Figure 4-30. Initialized HRWizard UserForm
A look at the Department combo box in Figure 4-31 shows us our list manager did
indeed bind the combo box to the Departments named range.
Figure 4-31. Department combo box bound to named range
3. Stop running the formby clicking the X button.
CHAPTER 4 n USERFORMS 182
Adding Navigation to the Form
Our navigation buttons have the task of moving us from step to step in our wizard application.
But they also need the ability to put the data from each screen into its place in the UserForm??™s
cPerson object.


Pages:
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191