Page 394 - Microsoft Office Excel 2003 Programming Inside Out
P. 394
Part 5: Manipulating Excel Objects
Microsoft Office Excel 2003 Programming Inside Out
Table 17-2. Key Properties and Methods of the CommandBar
Object (continued)
Property/Method Description
Left Property: contains the distance between the left edge of the
screen and the command bar in pixels.
Name Property: name of the command bar.
Position Property: contains the position of the command bar. Can be
any of these values: msoBarBottom, msoBarFloating,
msoBarLeft, msoBarMenuBar, msoBarPopup, msoBarRight,
or msoBarTop.
RowIndex Property: contains the relative position of a command bar in
a docking area.
ShowPopup(x, y) 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.
Top Property: contains the distance between the top edge of the
CommandBar and the top edge of the screen.
Type 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.
Visible 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.
Width 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 Type 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
Chapter 17
must be enabled. If the Visible property is True, 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 True.
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.
368