Name

commandbar.FindControl([Type], [Id], [Tag], [Visible], [Recursive])

Synopsis

Returns a CommandBarControl object from the command bar’s Controls collection using the Id or Tag properties of the control. Returns Nothing if the control is not found.

Argument

Settings

Type

An msoControlType constant indicating the type of control to return.

Id

The internal ID for the control. Use this argument to find built-in controls.

Tag

The Tag property associated with the control when it was created. Use this argument to find custom controls.

Visible

True includes only visible controls in the search; False includes all controls. Default is False.

Recursive

True includes controls on submenus and subtoolbars in the search; False searches only for top-level controls on the command bar. Default is False.

Built-in controls have unique Id properties but do not have a Tag property setting, while custom controls don’t have unique Id properties but may have unique Tag properties. See the Controls member topic for an example that lists the Id and Tag properties of controls on a command bar.

The Type argument allows you to specify the type of the control you want to find. Controls on a command bar can be referenced as the base CommandBarControl type or as a derived CommandBarButton, CommandBarComboBox, or CommandBarPopup type. Using those derived types rather than the base type lets you more easily use the full set of members provided by that type.

For example, the CopyFace method is ...

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.