Page 462 - Microsoft Office Excel 2003 Programming Inside Out
P. 462

Part 5:  Manipulating Excel Objects

                                        Microsoft Office Excel 2003 Programming Inside Out
                              Private Sub CommandButton1_Click()

                              End
                              End Sub

                              When the user presses the Prev button, the event associated with the control in the user form
                              module in the following listing is executed. This code computes the new page to be displayed
                              by subtracting 1 from the current page using the Value property. If the new page number is
                              greater than or equal to zero, then the new page number is assigned to the Value property;
                              otherwise, the click is just ignored.
                              Private Sub CommandButton2_Click()

              Chapter 20
                              Dim i As Long
                              i = MultiPage1.Value - 1

                              If i >= 0 Then
                                  MultiPage1.Value = i

                              End If
                              End Sub
                              The Next button uses similar code, but increments the MultiPage control’s Value property
                              and verifies that it is less than MultiPage1.Pages.Count.

                              Private Sub CommandButton3_Click()
                              Dim i As Long

                              i = MultiPage1.Value + 1
                              If i < MultiPage1.Pages.Count Then
                                  MultiPage1.Value = i
                              End If

                              End Sub
                              In addition to using the Prev and Next buttons, the user can directly select one of the wizard’s
                              steps from the tabs at the top of the MultiPage control. You can easily hide the tabs by setting
                              the multi-page control’s Style property to fmTabStyleNone.

                              Tip  Finding Hidden Controls
                              If a control is hidden on the form and you want to change one of its properties, simply select
                              the desired control from the drop-down list of controls at the top of the Properties window.





                 436
   457   458   459   460   461   462   463   464   465   466   467