Reputation: 2508
I would like to scrape data from a website that has a constantly changing table, and i would like to get the last children data from said table, i tried searching online and testing with some codes such as
oElement(1).children(n).innerText
as well as
oElement(1).lastChild.innerText
but to no avail, how can i do this ?
Thanks.
Upvotes: 2
Views: 469
Reputation: 10679
Use the length
property of the children
collection to access the last element:
With oElement(1).children
MsgBox .item(.length - 1).innerText
End With
Upvotes: 1
Reputation: 2508
So i've found out a way, which is to do a loop until its null or nothing then take the previous entry,
i = 0
Do Until oElement(4).Children(i) = "" Or Null
If oElement(4).Children(i) <> "" Then
i = i + 1
End If
Loop
Debug.print oElement(4).children(i - 1)
worked for me, but if anyone have a less tedious and straight forward answer, please do comment :)
Upvotes: 0