Table of contents
TOC
Collapse the table of content
Expand the table of content

CommandBarComboBox.Text Property (Office)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

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 component of the Microsoft Office Fluent 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.

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

Concepts

CommandBarComboBox Object

Other resources

CommandBarComboBox Object Members

© 2018 Microsoft