CommandBars Property

Returns a CommandBars collection that represents all the command bars in the application or project. Read-only.

Remarks

For more information, see CommandBars Collection Object in the Microsoft Office Visual Basic Reference.

Example

This example deletes all custom command bars that aren't visible.

Sub RemoveCommandBars()
    Dim Bar As CommandBar
    
    For Each Bar In Application.CommandBars
        If Not Bar.BuiltIn And Not Bar.Visible Then Bar.Delete
    Next

End Sub

Applies to | Application Object | Project Object, Projects Collection Object