Table of contents
Collapse the table of content
Expand the table of content

CommandBars.FindControls Method (Office)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Gets the CommandBarControls collection that fits the specified criteria.

Note The use of CommandBars in some Microsoft Office applications has been superseded by the new ribbon component of the Microsoft Office Fluent user interface. For more information, search Help for the keyword "ribbon."


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

expression A variable that represents a CommandBars object.


NameRequired/OptionalData TypeDescription
TypeOptionalVariantIs one of the MsoControlType constants specfying the type of control.
IdOptionalVariantThe control's identifier.
TagOptionalVariantThe control's tag value.
VisibleOptionalVariantTrue to include only visible command bar controls in the search. The default value is False.

Return Value



If no controls that fits the criteria are found, the FindControls method returns Nothing.


This example uses the FindControls method to return all members of the CommandBars collection that have an ID of 18 and displays (in a message box) the number of controls that meet the search criteria.

Dim myControls As CommandBarControls 
Set myControls = CommandBars.FindControls(Type:=msoControlButton, ID:=18) 
MsgBox "There are " & myControls.Count & _ 
    " controls that meet the search criteria."

See also


CommandBars Object

Other resources

CommandBars Object Members

© 2018 Microsoft