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

Name Property Example

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

The following example displays the Name property of each control on a form. This example uses the Controls collection to cycle through all the controls placed directly on the Userform.

To use this example, copy this sample code to the Declarations portion of a form. Make sure that the form contains a CommandButton named CommandButton1 and several other controls.

Private Sub CommandButton1_Click() 
 Dim MyControl As Control 

 For Each MyControl In Controls 
 MsgBox "MyControl.Name = " &; MyControl.Name 
 Next 
End Sub
© 2018 Microsoft