Actually, Serge, with your code, if I have an array of 5 CommandButtons, and I did something like this:
Then IsItAnArray would be False, even though it should be True.Code:Set MyControl = MyCommandButtonArray(0) ' First button in array IsItAnArray = IsControlArray(MyControl)
Here's a better way:
Code:Function IsItAnArray(pControl As Control) As Boolean On Error Resume Next ' Dummy comparison, to see if the Index property is accessible If pControl.Index = pControl.Index Then IsItAnArray = (Err.Number = 0) End Function





Reply With Quote