Microsoft Office Tutorials and References
In Depth Information
Creating Wizards
15-10) to verify that the user really wants to exit. If the user clicks the Yes button, the UserForm is
unloaded with no action taken. This type of verification, of course, is optional.
Private Sub CancelButton_Click()
Dim Msg As String
Dim Ans As Integer
Msg = “Cancel the wizard?”
Ans = MsgBox(Msg, vbQuestion + vbYesNo, APPNAME)
If Ans = vbYes Then Unload Me
End Sub
Figure 15-10: Clicking the Cancel button displays a confirmation message box.
The event-handler procedures for the Back and Next buttons follow:
Private Sub BackButton_Click()
MultiPage1.Value = MultiPage1.Value - 1
UpdateControls
End Sub
Private Sub NextButton_Click()
MultiPage1.Value = MultiPage1.Value + 1
UpdateControls
End Sub
These two procedures are very simple. They change the Value property of the MultiPage
control and then call another procedure named UpdateControls (which follows).
The UpdateControls procedure is responsible for enabling and disabling the BackButton
and NextButton controls.
Sub UpdateControls()
Select Case MultiPage1.Value
Case 0
BackButton.Enabled = False
NextButton.Enabled = True
Case MultiPage1.Pages.Count - 1
BackButton.Enabled = True
NextButton.Enabled = False
 
Search JabSto ::




Custom Search