Controls collection (Microsoft Forms)

Includes all the controls contained in an object.

Remarks

Each control in the Controls collection of an object has a unique index whose value can be either an integer or a string. The index value for the first control in a collection is 0; the value for the second control is 1, and so on. This value indicates the order in which controls were added to the collection.

If the index is a string, it represents the name of the control. The Name property of a control also specifies a control's name.

Use the Controls collection to enumerate or count individual controls, and to set their properties. For example, you can enumerate the Controls collection of a particular form and set the Height property of each control to a specified value.

Note

The For Each...Next statement is useful for enumerating a collection.

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.