Using VarType will work IF the control has a default member and that default member returns value other than vbObject. If the control doesn't have a default member, it will always return false.
One solution is to enumerate the items in the control array and compare the Index of each item.
Hope it will help youCode:Function CheckCtrlIndex(ctrlArray As Object, ByVal idx As Integer) As Boolean Dim result As Boolean, ctrl As Control For Each ctrl In ctrlArray If ctrl.Index = idx Then result = True Exit For End If Next ctrl CheckCtrlIndex = result End Function![]()




Reply With Quote