Microsoft Office Tutorials and References
In Depth Information
Table 17-2. Key Properties and Methods of the CommandBar
Property: contains the distance between the left edge of the
screen and the command bar in pixels.
Property: name of the command bar.
Property: contains the position of the command bar. Can be
any of these values: msoBarBottom , msoBarFloating ,
msoBarLeft , msoBarMenuBar , msoBarPopup , msoBarRight ,
or msoBarTop .
Property: contains the relative position of a command bar in
a docking area.
Method: displays a CommandBar as a shortcut menu at the
specified location. If x and y are omitted, the current x and y
coordinates from the pointer are used.
Property: contains the distance between the top edge of the
CommandBar and the top edge of the screen.
Property (read-only): indicates the command bar’s type.
msoBarTypeMenuBar means that the command bar contains
menu buttons; msoBarTypeNormal means that the command
bar displays icons; msoBarTypePopup means that the
command bar is a shortcut menu.
Property: True when the command bar is displayed on the
screen. Remember that the Enabled property must be True
before you can set this property to True .
Property: contains the width of the command bar in pixels.
Each CommandBar object represents a collection of menu items and toolbar icons that can be
displayed on screen. The exact type is identified by the Ty pe property. The Controls collection
contains the set of command bar control objects that are present in the command bar.
The Enabled and Visible properties determine if the command bar is seen by the user and
available for use. Right-clicking while the mouse pointer is hovering over any toolbar will list
all the command bars that can be displayed. To be included on this list, the command bar
must be enabled. If the Visible property is Tr ue , the command bar name will be preceded by
a check mark on the shortcut menu, indicating that it is visible, too.
You can determine if the command bar was originally included in Excel by checking to see if
the BuiltIn property is set to Tr ue .
The FindControl method locates a specific control based on the some of the control’s prop
erty values. This can be extremely useful if the user has moved the control from its original
location onto a different CommandBar object.