catching an error in call to a collection
Posted on 2006-05-08
I have a collection and I'm running a loop that makes calls to it to get values based on the item values. However, I don't know how to catch an error where an item doens't exist in the collection. For example:
dim test as collection
' test containts the following items "a", "b", "c" as the keys
What if I make a call to test with key = "d".
How do I catch the error or determine using the error object that an invalid key was used with the collection?
I tried msgbox test("d") but I got an object not defined error.