We then have a couple variables that are set to the MSForms.CommandButton object type.
These are declared WithEvents.We are going to let our cStepManager class maintain the state
of these buttons. The WithEvents declaration lets us trap their Click event and act on it inside
of our class. We will use the Click event to determine whether the button should be enabled
based on where the user is in the wizard process.
Add the following properties to cStepManager:
Public Property Get NumberOfSettings() As Integer
NumberOfSettings = m_iNumSettings
End Property
Public Property Let NumberOfSettings(newNum As Integer)
m_iNumSettings = newNum
End Property
'Worksheet Property: Gets/Sets the sheet containing the step information
Public Property Get Worksheet() As Worksheet
Set Worksheet = m_oWorksheet
End Property
Public Property Set Worksheet(newWorksheet As Worksheet)
Set m_oWorksheet = newWorksheet
End Property
Public Property Get CurrentPage() As Integer
CurrentPage = m_iCurrentPage
End Property
Public Property Let CurrentPage(newPage As Integer)
m_iCurrentPage = newPage
End Property
Public Property Get PreviousPage() As Integer
PreviousPage = m_iCurrentPage - 1
End Property
Public Property Get NextPage() As Integer
NextPage = m_iCurrentPage + 1
End Property
Public Property Set PreviousButton(newPreviousBtn As MSForms.CommandButton)
Set m_oPreviousButton = newPreviousBtn
End Property
CHAPTER 4 n USERFORMS 174
Public Property Set NextButton(newNextBtn As MSForms.
Pages:
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183