Share via


CommandBars.FindControl Method

Office Developer Reference

Gets a CommandBarControl object that fits a specified criteria.

Aa432802.vs_note(en-us,office.12).gif  Note
The use of CommandBars in some Microsoft Office applications has been superseded by the new Ribbon user interface. For more information, search help for the keyword "Ribbon."

Syntax

expression.FindControl(Type, Id, Tag, Visible)

expression   A variable that represents a CommandBars object.

Parameters

Name Required/Optional Data Type Description
Type Optional Variant The type of control.
Id Optional Variant The identifier of the control.
Tag Optional Variant The tag value of the control.
Visible Optional Variant True to include only visible command bar controls in the search. The default value is False. Visible command bars include all visible toolbars and any menus that are open at the time the FindControl method is executed.

Return Value
CommandBarControl

Remarks

If the CommandBars collection contains two or more controls that fit the search criteria, FindControl returns the first control that's found. If no control that fits the criteria is found, FindControl returns Nothing.

See Also