This can be done by using the is operator. Here is a simple function demonstrating this method:
Public Function RemoveObject(Collection As Collection, Object As Object)Dim vTemp As ObjectDim Index As Integer Index = 1 For Each vTemp In Collection If vTemp Is Object Then Collection.Remove Index Else Index = Index + 1 End If NextEnd FunctionIf there is only a single instance in the collecion, you can add an exit for:Public Function RemoveObject(Collection As Collection, Object As Object)Dim vTemp As ObjectDim Index As Integer Index = 1 For Each vTemp In Collection If vTemp Is Object Then Collection.Remove Index Exit For Else Index = Index + 1 End If NextEnd Function
size=3>