正如标题所示,我正在尝试获取表单控件的相关标签的标题 例如:
Dim ctl As Control
Dim errMess As String
errMess = ""
For Each ctl In frm
With ctl
If (ctl.Tag = "*") Then
errMess = errMess & ctl.Caption & vbNewLine
End If
End If
End With
Next ctl
显然“ctl.Caption”不起作用,我只是不确定如何引用它。
任何帮助表示感谢。
干杯
诺尔
答案 0 :(得分:1)
发现答案是使用ctl.Controls.Item(0).Caption
Dim ctl As Control
Dim errMess As String
errMess = ""
For Each ctl In frm
With ctl
If (ctl.Tag = "*") Then
errMess = errMess & ctl.Controls.Item(0).Caption & vbNewLine
End If
End If
End With
Next ctl