it'd be awesome if you could help me with this persistent error. I'm trying to scrape a table from a website on IE and insert it into a 2 dimensional array.
The code is as follows:
Dim matrix(25, 7) As Variant
Set doc = ie.Document
Set Tbl = doc.getElementsByTagName("td").Item(6)
matrix(0, 1) = Tbl.innerText
Set Tbl = doc.getElementsByTagName("td").Item(7)
matrix(0, 2) = Tbl.innerText
Set Tbl = doc.getElementsByTagName("td").Item(20)
matrix(0, 3) = Tbl.innerText [Error Points to this line]
I've had several tries at troubleshooting. No luck. It works till item is up to 12--item(12). What exactly am I getting wrong or missing here? This is just a part of the code. There's more but it doesn't proceed further as the error occurs on the last line of this bunch. thanks.
For instance, I know it should work and that (20) has data because this test loop works perfectly.
Dim a As Integer
a = 0
Do While a < 200
MsgBox (a)
q = ie.Document.getElementsByTagName("td").Item(a).innerText
MsgBox (q)
a = a + 1
Loop
When a = 20, Msgbox displays an address that is on the table of the webpage.
doc.getElementsByTagName("td").Item(20)i.e.TblisNothing?