Application.CommandBars property (Project)

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

Syntax

expression.CommandBars

expression A variable that represents an Application object.

Remarks

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

Example

The following 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

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.