Excel 2013 Power Programming with VBA by John Walkenbach

Excel 2013 Power Programming with VBA by John Walkenbach

Author:John Walkenbach
Language: eng
Format: epub
Publisher: Wiley Publishing
Published: 2013-03-10T16:00:00+00:00


Figure 12-17: MultiPage groups your controls on pages, making them accessible from a tab.

This example is available on the book's website in the file named multipage control demo.xlsm.

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

Using a MultiPage control can be 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 property. A value of 0 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 VBE, right-click a tab and choose 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 may 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 choose 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.

Using an External Control

The example in this section uses the Windows Media Player ActiveX control. Although this control isn't an Excel control (it's installed with Windows), it works fine in a UserForm.

To make this control available, add a UserForm to a workbook and follow these steps:

1. Activate VBE.

2. Right-click the Toolbox and choose Additional Controls.

Choose View⇒Toolbox if the Toolbox isn't visible.

3. In the Additional Controls dialog box, scroll down and place a check mark next to Windows Media Player.

4. Click OK.

Your Toolbox will display a new control.

Figure 12-18 shows the Windows Media Player control in a UserForm, along with the Property window. The URL property represents the media item being played (music or video). If the item is on your hard drive, the URL property will contain the full path along with the filename.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.