Properties of command bars

The following are some of the more useful properties of a CommandBar object:

♦ BuiltIn: Read-only. True if the object is one of Excel's built-in command bars.

♦ Enabled: If False, the command bar is hidden and does not appear in the list of available command bars.

♦ Left: The command bar's left position in pixels.

♦ Name: The command bar's display name.

♦ Position: An integer that specifies the position of the command bar. Possible values are as follows:

■ msoBarLeft: The command bar is docked on the left.

■ msoBarTop: The command bar is docked on the top.

■ msoBarRight: The command bar is docked on the right.

■ msoBarBottom: The command bar is docked on the bottom.

■ msoBarFloating: The command bar isn't docked.

■ msoBarPopup: The command bar is a shortcut menu.

♦ Protection: An integer that specifies the type of protection for the command bar.

Possible values are as follows:

■ msoBarNoProtection: (Default) Not protected. The command bar can be customized by the user.

■ msoBarNoCustomize: The command bar cannot be customized.

■ msoBarNoResize: The command bar cannot be resized.

■ msoBarNoMove: The command bar cannot be moved.

■ msoBarNoChangeVisible: The command bar's visibility state cannot be changed by the user.

■ msoBarNoChangeDock: The command bar cannot be docked to a different position.

■ msoBarNoVerticalDock: The command bar cannot be docked along the left or right edge of the window.

■ msoBarNoHorizontalDock: The command bar cannot be docked along the top or bottom edge of the window.

♦ Top: The command bar's top position in pixels.

♦ Type: Returns an integer that represents the type of command bar. Possible values are as follows:

■ msoBarTypeNormal: Toolbar.

■ msoBarTypeMenuBar: Menu bar.

■ msoBarTypePopUp: Shortcut menu.

♦ Visible: True if the command bar is visible.

The VBA examples in the following sections demonstrate the use of some of the command bar properties.

0 0

Post a comment