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 178 | Next

Jim DeMarco

"Pro Excel 2007 VBA"

Add the following code:
Private Sub InitLists()
With m_oLM
.BindListToRange "Departments", Me.cboDept
.BindListToRange "Locations", Me.cboLocation
.BindListToRange "NetworkLvl", Me.cboNetworkLvl
.BindListToRange "ParkingSpot", Me.cboParkingSpot
.BindListToRange "YN", Me.cboRemoteAccess
End With
End Sub
Again, this is very simple code that calls the cListManager object??™s BindListToRange
method for each list in the application.
Initializing the Form
Our final step in setting up the application is to initialize the UserForm itself. Create a new
subroutine named InitForm. Add the following code:
Private Sub InitForm()
Dim iFirstPage As Integer
Dim i As Integer
Dim iPageCount As Integer
iFirstPage = m_colSteps("1").Order - 1
Me.MultiPage1.Value = iFirstPage
Me.MultiPage1.Pages((m_colSteps("1").Page) - 1).Caption = m_colSteps("1").Caption
m_oWizard.HandleControls
iPageCount = MultiPage1.Pages.Count
For i = 1 To iPageCount - 1
MultiPage1.Pages(i).Visible = False
Next
End Sub
Here we are setting our MultiPage control??™s Value property to the PageSetting collection??™s
(m_colSteps) item (whose key value is 1), and setting its caption:
CHAPTER 4 n USERFORMS 180
iFirstPage = m_colSteps("1").Order - 1
Me.MultiPage1.Value = iFirstPage
Me.MultiPage1.Pages((m_colSteps("1").Page) - 1).Caption = m_colSteps("1").Caption
Remember that we passed in the value of the Order property as the key. This makes it very
easy for us to determine which page to move to.


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