Microsoft Office Tutorials and References
In Depth Information
Set cb = c.Controls.Add(msoControlButton, 4)
cb.Style = msoButtonIconAndCaption
cb.Caption = "icon and caption button"
Combo Box Controls
There are a number of different variations of the combo box control that you can choose
from. (See Table 17-4.) All these variations have one thing in common: the user is allowed to
choose from a list of items. All but one of the extra properties and methods are devoted to
managing the list of items. (See Table 17-7.)
Table 17-7. Unique Properties and Methods of the CommandBarComboBox
Method: adds the value contained in Text to the list at the
specified Index position. If Index is omitted, the item is added to
the end of the list.
Method: removes all the list items from the list associated with
the combo box.
Property: contains the number of lines displayed in a drop-down
list box or a combo box.
Property: returns a string value representing the item in the list
position specified by Index . Remember that the first item in the list
has an Index value of 1.
Property (read-only): returns the number of items in the list.
Property: contains the number of list items that appear above the
Property: contains the item number of the currently selected item
in the list portion of the combo box control. A value of zero means
that nothing is selected.
Method: removes the item from the list at the position specified
by Index .
Property: specifies the appearance of the control. Can be either
msoComboLabel or msoComboNormal .
The list of items that appears in a combo box is essentially a string array. You can retrieve or
change an element though the List property by specifying the item’s relative location in the
list. The ListIndex property points to the currently selected item in the list, whereas the
ListCount contains the total number of items in the list.