The Multi Page Control

The MultiPage control is another example of a container control that groups or organizes the user interface on a form into multiple categories. An example of the MultiPage control in the Excel application is the Options dialog box shown in Figure 6.10. The Options dialog can be selected in the Excel application from the Tools menu. You can see from this example that the MultiPage control allows you to cram a lot of options onto a single form.

Page tabs

The Options dialog in Excel.

Page tabs

The Options dialog in Excel.

Multipage Vba

The MultiPage control allows you to design an interface with multiple pages that group a related set of controls. The different pages are selected using the page tabs.

The MultiPage control is a container for a Pages collection object; each page on a MultiPage control is a Page object contained in the Pages collection. As with most container controls, you generally set their appearance at Design Time and you only write a minimum amount of code for them (if any), unless a specific path to a Page object is required.

By default, when you add a MultiPage control to a form, two pages are included. To add more pages, right click on a page tab while in Design Mode and select New Page from the shortcut menu. Figure 6.11 shows a form in Design Mode containing a MultiPage control.

Excel Vba Multiseiten

Figure 6.ii)

VBA's MultiPage control.

Properties of the MultiPage control that you will want to investigate include the Style, TabOrientation, and MultiRow properties which set the appearance and location of the tabs.

The SelectedItem property returns the currently selected Page object. It is useful for identifying what page on the MultiPage control is active. For example:

If MultiPagel.Selectedltem.Caption = "Page 1" Then

MsgBox "You are viewing page 1." End If

Interestingly, there is no Activated or Select() method of the MultiPage or Page objects. These seem like the consistent choices for methods that should select specific Page objects. Instead, you can set the Value property of the MultiPage control to an index value representing a specific Page object in the Pages collection object. The following line of code selects the second page (index numbers start at zero) of a MultiPage control.

MultiPagel.Value = 1

If you select a page on the MultiPage control while in Design Mode, you will have access to the Design Mode properties of a Page object. There aren't many properties, but the Name and Caption properties of each Page object should be changed from their default values.

The Page object has no events, and the event procedures unique to the MultiPage control are seldom used except in more advanced applications; thus, they will not be discussed. However, the MultiPage control does have a few common event procedures such as Click() and Change() with which you should already have some familiarity.

Was this article helpful?

+4 -2
Biorhythm Awareness

Biorhythm Awareness

Who else wants to take advantage of biorhythm awareness to avoid premature death, escape life threatening diseases, eliminate most of your life altering mistakes and banish catastrophic events from your life.

Get My Free Ebook


  • Asmarina
    How to give pageindex in multipage userform?
    3 years ago
  • Magnus
    How to know if a page is selected in multi page option in vba?
    2 years ago
  • frank
    How to use excel vba multi page?
    2 years ago
  • cipriano
    What excel controls use on hover event?
    4 months ago
  • bellina
    How many pages can be in a multipage activex object?
    2 months ago
  • Artemisia
    How to select a page in a multipage vba excel?
    2 months ago
  • dolcelino
    How find a control on a multipage userform VBA?
    1 month ago

Post a comment