Using the MultiPage Control in a UserForm


The MultiPage control is very useful for UserForms that must display many controls. The MultiPage control lets you group the choices and place each group on a separate tab.

Figure 14-18 shows an example of a UserForm that contains a MultiPage control. In this case, the control has three pages, each with its own tab.

image from book
Figure 14-18: MultiPage groups your controls on pages, making them accessible from a tab.
CD-ROM  

This example is available on the companion CD-ROM. The file is named image from book  multipage control demo.xlsm .

Note  

The Toolbox also contains a control named TabStrip , which resembles a MultiPage control. However, unlike the MultiPage control, the TabStrip control is not a container for other objects. The MultiPage control is much more versatile, and I've never had a need to actually use the TabStrip control.

Using a MultiPage control can be a bit tricky. The following are some things to keep in mind when using this control:

  • The tab (or page) that's displayed up front is determined by the control's Value function. A value of displays the first tab, a value of 1 displays the second tab, and so on.

  • By default, a MultiPage control has two pages. To add a new page in the VBE, right-click a tab and select New Page from the shortcut menu.

  • When you're working with a MultiPage control, just click a tab to set the properties for that particular page. The Properties window will display the properties that you can adjust.

  • You might find it difficult to select the actual MultiPage control because clicking the control selects a page within the control. To select the control itself, click its border. Or, you can use the Tab key to cycle among all the controls. Yet another option is to select the MultiPage control from the drop-down list in the Properties window.

  • If your MultiPage control has lots of tabs, you can set its MultiRow property to True to display the tabs in more than one row.

  • If you prefer, you can display buttons instead of tabs. Just change the Style property to 1 . If the Style property value is 2 , the MultiPage control won't display tabs or buttons.

  • The TabOrientation property determines the location of the tabs on the MultiPage control.

  • For each page, you can set a transition effect by changing the TransitionEffect property. For example, clicking a tab can cause the new page to push the former page out of the way. Use the TransitionPeriod property to set the speed of the transition effect.




Excel 2007 Power Programming with VBA
Excel 2007 Power Programming with VBA (Mr. Spreadsheets Bookshelf)
ISBN: 0470044012
EAN: 2147483647
Year: 2007
Pages: 319

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net