Here's a possible solution
Enter this code onto a form. It will demonstrate trying to get an object from a collection, using the key value.
The program will error out at the line
item = col.item("iv")
If you trap it with an error trap, then you have your method of quickly checking to see if an object is in a collection.
Does this help?
Samwise Galenorn
[email protected]
Private Sub Form_Load()
Dim item
Dim col as New Collection
col.Add "one", "i"
col.Add "two", "ii"
col.Add "three", "iii"
item = col.item("iii")
MsgBox "item 'iii' is " & item
item = col.item("iv")
MsgBox "item 'iv' is " & item
End Sub