Share via


Application.CommandBars Property

Project Developer Reference

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

Syntax

expression.CommandBars

expression   A variable that represents an Application object.

Return Value
[COMMANDBARS]

Remarks

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

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

Visual Basic for Applications
  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

See Also