如何取得当前焦点控件数组的最大下标
UBound(Me.ActiveControl)提示“缺少数组”
Me.ActiveControl.UBound 提示“对象不支持该属性或方法”
[最优解释]
枚举。
[其他解释]
Private Function GetActiveCtrlUbound() As Integer
Dim x As VB.Control
Dim MaxIndex As Integer
For Each x In Me.Controls
If VBA.VarType(VBA.CallByName(Me, x.Name, VbGet)) = vbObject Then '控件数组
If x.Name = Me.ActiveControl.Name Then
If MaxIndex < x.Index Then MaxIndex = x.Index
End If
End If
Next
GetActiveCtrlUbound = MaxIndex
End Function
[其他解释]