Page 404 - Microsoft Office Excel 2003 Programming Inside Out
P. 404

Part 5:  Manipulating Excel Objects
                                        Microsoft Office Excel 2003 Programming Inside Out

                             Set  cb  =  c.Controls.Add(msoControlButton,  4)
                             cb.Style  =  msoButtonIconAndCaption
                             cb.Caption  =  "icon  and  caption  button"
                             End  Sub


                    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
                             Object
                             Property/Method     Description
                             AddItem(Text, Index)	  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.
                             Clear	              Method: removes all the list items from the list associated with
                                                 the combo box.
                             DropDownLines	      Property: contains the number of lines displayed in a drop-down
                                                 list box or a combo box.
                             List(Index)	        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.
                             ListCount           Property (read-only): returns the number of items in the list.
                             ListHeaderCount	    Property: contains the number of list items that appear above the
                                                 separator line.
                             ListIndex	          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.
                             RemoveItem(Index)	  Method: removes the item from the list at the position specified
                                                 by Index.
                             Style	              Property: specifies the appearance of the control. Can be either
             Chapter 17
                                                 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.






                378
   399   400   401   402   403   404   405   406   407   408   409