在窗体上建上各种控件,执行代码,立即窗口查看返回的结果.
Private Sub Command25_Click()
Dim ctl As Control
For Each ctl In Me.Controls
Debug.Print ctl.Name, ctl.ControlType, TypeName(ctl)
Next
End Sub
返回结果:
Check0 106 Checkbox
Label1 100 Label
Option2 105 OptionButton
Label3 100 Label
Frame4 107 OptionGroup
Label5 100 Label
Label6 100 Label
Text7 109 Textbox
Label8 100 Label
PageBreak9 118 PageBreak
Image10 103 Image
Child11 112 SubForm
Label12 100 Label
OLEBound13 108 BoundObjectFrame
Label14 100 Label
OLEUnbound16 114 ObjectFrame
选项卡控件17 123 TabControl
页18 124 Page
页19 124 Page
Line20 102 Line
Box21 101 Rectangle
ListViewCtl2 119 CustomControl
TreeView3 119 CustomControl
DTPicker4 119 CustomControl
Command25 104 CommandButton