Gets or sets the text in the display or edit portion of the CommandBarComboBox control. Read/write.

Note
The use of CommandBars in some Microsoft Office applications has been superseded by the new Ribbon user interface. For more information, search help for the keyword "Ribbon."

Syntax

expression.Text

expression A variable that represents a CommandBarComboBox object.

Return Value
String

Example
This example creates a new command bar named "Custom" and adds to it a combo box that contains four list items. The example then uses the Text property to set Item 3 as the default list item.

Visual Basic for Applications
Set myBar = CommandBars _ .Add(Name:="Custom", Position:=msoBarTop, _ Temporary:=True) With myBar .Controls.Add Type:=msoControlComboBox, ID:=1 .Visible = True End With Set testComboBox = CommandBars("Custom").Controls(1) With testComboBox .AddItem "Item 1", 1 .AddItem "Item 2", 2 .AddItem "Item 3", 3 .AddItem "Item 4", 4 .Text = "Item 3" End With

See also: