Thanks for the reply guys. Sorry for the confusion, the collection I referred here is not the VBA collection object rather its a collection of HTML object as below
---[Code]
Set objCollection = m_IE.Document.getElementsByTagName("input")
---[/Code]
Where m_IE is IE object.
What I am trying to do here is read each input tag present in HTML doc and compare with the defined properties in a dictionary object e.g.
---[Code]
Set oDict = New Dictionary
oDict.Add "id" , "SomeID"
oDict.Add "class" , "SomeClass"
'Have some more key value pairs
---[/Code]
Now in order to compare, I have following code
---[Code]
Set objCollection = m_IE.Document.getElementsByTagName("input")
CountInput = objCollection.Length 'Where objCollection.Length will contain number of input tags
For i = 1 To CountInput
For Each Key In oDict.Keys
If Key <> "" Then
If oDict(Key) = objCollection(i).Key Then '#########PRBLEM LINE#######
'Do something
End If
End If
Next Key
Next i
---[/Code]
Referring to problem line above, objCollection(i) returns me an HTML object. This object will have properties like id, class etc.
In order to compare the html object to my internal dict object i am trying to evaluate expressiono "objCollection(i).Key" at run time.
e.g. in the loop When oDict("id") = "SomeID" then objCollection(i).id should be calculated and "SomeID" should be compared against that.
PS: Sorry for the long post, but I just tried to elaborate on what I am trying to achieve.