title | keywords | f1_keywords | api_name | ms.assetid | ms.date | ms.localizationpriority | ||
---|---|---|---|---|---|---|---|---|
Workbook.CommandBars property (Excel) |
vbaxl10.chm199089 |
|
|
8d93b8cd-c4e3-b216-eda0-da4c6e573c40 |
05/29/2019 |
medium |
Returns a CommandBars object that represents the Microsoft Excel command bars. Read-only.
expression.CommandBars
expression An expression that returns a Workbook object.
Used with the Application object, this property returns the set of built-in and custom command bars available to the application.
When a workbook is embedded in another application and activated by the user by double-clicking the workbook, using this property with a Workbook object returns the set of Microsoft Excel command bars available within the other application. At all other times, using this property with a Workbook object returns Nothing.
There is no programmatic way to return the set of command bars attached to a workbook.
This example deletes all custom command bars that aren't visible.
For Each bar In Application.CommandBars
If Not bar.BuiltIn And Not bar.Visible Then bar.Delete
Next
[!includeSupport and feedback]