# CommandBars Property

A read-only property that returns a reference to the Microsoft Office CommandBars collection object contained in the window that is associated with the Window object.

expression.CommandBars

expression Required. An expression that returns a reference to the Window object.

## Security Level

3: Can be accessed only by fully trusted forms.

## Remarks

The CommandBars property can be used only by fully trusted forms. If used by a form that is not fully trusted, the CommandBars property will return a "permission denied" error.

## Example

In the following example, the CommandBars property of the Window object is used to set a reference to the CommandBars collection object:

    var objCommandBars;
    objCommandBars = Application.ActiveWindow.CommandBars;

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp