![]() |
Help with Evaluate/Eval
Hi,
Could someone please help me out implementing evaluate/eval function in excel vba. in the code snippet below, i am navigating through a collection object and trying to find value of a item based on the key. For i = 0 To objCollection.Length - 1 Key = "id" strTemp = "objCollection(" & i & ")." & Key msgbox Evaluate(Chr(34) & strTemp & Chr(34) ) Next i Following message box returns text objCollection(o).id, but i want this to be calculated and show me the actual value. Thanks in advance. -Avinash |
Help with Evaluate/Eval
Avi wrote :
Hi, Could someone please help me out implementing evaluate/eval function in excel vba. in the code snippet below, i am navigating through a collection object and trying to find value of a item based on the key. For i = 0 To objCollection.Length - 1 Key = "id" strTemp = "objCollection(" & i & ")." & Key msgbox Evaluate(Chr(34) & strTemp & Chr(34) ) Next i Following message box returns text objCollection(o).id, but i want this to be calculated and show me the actual value. Thanks in advance. -Avinash You need to specify an objCollection.Item(i) to return the value held at position i. Specify objCollection.Key to return its value if not an integer. Also, not sure why you start your loop at zero to have to subtract 1 to get the UBound of your counter... For i = 1 To objCollection.Count ...where i is type Long so it matches .Count! -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
Help with Evaluate/Eval
In order to get started correctly...
A Collection is 1 based. A Collection does not have a Length property. A Collection does have a Count property. -- Jim Cone Portland, Oregon USA http://www.mediafire.com/PrimitiveSoftware (List Files XL add-in: finds and lists files/folders with hyperlinks) "Avi" wrote in message ... Hi, Could someone please help me out implementing evaluate/eval function in excel vba. in the code snippet below, i am navigating through a collection object and trying to find value of a item based on the key. For i = 0 To objCollection.Length - 1 Key = "id" strTemp = "objCollection(" & i & ")." & Key msgbox Evaluate(Chr(34) & strTemp & Chr(34) ) Next i Following message box returns text objCollection(o).id, but i want this to be calculated and show me the actual value. Thanks in advance. -Avinash |
Help with Evaluate/Eval
On Wednesday, April 11, 2012 10:19:07 AM UTC+5:30, Jim Cone wrote:
In order to get started correctly... A Collection is 1 based. A Collection does not have a Length property. A Collection does have a Count property. -- Jim Cone Portland, Oregon USA http://www.mediafire.com/PrimitiveSoftware (List Files XL add-in: finds and lists files/folders with hyperlinks) "Avi" wrote in message ... Hi, Could someone please help me out implementing evaluate/eval function in excel vba. in the code snippet below, i am navigating through a collection object and trying to find value of a item based on the key. For i = 0 To objCollection.Length - 1 Key = "id" strTemp = "objCollection(" & i & ")." & Key msgbox Evaluate(Chr(34) & strTemp & Chr(34) ) Next i Following message box returns text objCollection(o).id, but i want this to be calculated and show me the actual value. Thanks in advance. -Avinash 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") 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 --- Code:
Set objCollection = m_IE.Document.getElementsByTagName("input") 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. |
All times are GMT +1. The time now is 04:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com