collection
- From: "Stephanie" <IwishICould@xxxxxxxxx>
- Date: Fri, 8 Jul 2005 13:20:34 -0400
My memory is not working well, nor apparently is my ability to find
something simple in the help. I have a bit of code that I inherited. I need
to replace the reliance on handling an error and check for the existence of
the item in the collection directly.
I would like to iterate through the collection and determine the value of
the *key*. I see how to get the item, but with Add, Item and Remove being
the only methods... How can I iterate through the items in a collection and
retrieve the key?
Thanks.
On Error Resume Next
' First, see if anything is there. We can't just access the member of
the
' collection and assign it to a variable, because we don't know what
type of
' variable is in the collection, so we just do a VarType() on it.
eVarType = VarType(oCollection.Item(sKey))
If Err.Number = 0 Then
' It's in there.
bRetVal = True
Else
' It's not in there.
bRetVal = False
End If
.
- Follow-Ups:
- Re: collection
- From: Ken Halter
- Re: collection
- From: Jeff Johnson [MVP: VB]
- Re: collection
- Prev by Date: Re: Inputbox Question
- Next by Date: Re: collection
- Previous by thread: Oleaut32
- Next by thread: Re: collection
- Index(es):
Relevant Pages
|