CommandBar.Type property (Office)

Gets the type of command bar. Read-only.

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, see Overview of the Office Fluent ribbon.

Syntax

expression.Type

expression Required. A variable that represents a CommandBar object.

Example

This example finds the first control on the command bar named Custom. Using the Type property, the example determines whether the control is a button. If the control is a button, the example copies the face of the Copy button (on the Standard toolbar), and then pastes it onto the control.

Set oldCtrl = CommandBars("Custom").Controls(1) 
If oldCtrl.Type = msoControlButton Then 
    Set newCtrl = CommandBars.FindControl(Type:= _ 
        MsoControlButton, ID:= _ 
        CommandBars("Standard").Controls("Copy").ID) 
    NewCtrl.CopyFace 
    OldCtrl.PasteFace 
End If

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.