Nelson78
Well-known Member
- Joined
- Sep 11, 2017
- Messages
- 526
- Office Version
- 2007
Hello everybody.
I use to scrap data from a table with the following code:
This works perfectly, except for a point.
In one of the columns of the table, sometime it is possible to find an image.
I can't detect it with the code above.
Parsing the framework this way:
trs
item2
cells
item13
innerhtml
I can found inside the value of that innerhtml an item:
That is the info I need for any row of the table, answering the question: is there the Image07? (Yes/No).
How can I figure it out?
I use to scrap data from a table with the following code:
VBA Code:
Dim tbls, tbl, trs, tr, tds, td, R, c
Set tbls = IE.document.getElementsByTagName("table")
For R = 0 To tbls.Length - 1
Debug.Print R, tbls(R).Rows.Length
Next R
Set tbl = IE.document.getElementsByTagName("table")(8)
Set trs = tbl.getElementsByTagName("tr")
For R = 0 To trs.Length - 1
Set tds = trs(R).getElementsByTagName("td")
If tds.Length = 0 Then Set tds = trs(R).getElementsByTagName("th")
For c = 0 To tds.Length - 1
Worksheets("Sheets2").Range("A1").Offset(R, c).Value = tds(c).innerText
Next c
Next R
This works perfectly, except for a point.
In one of the columns of the table, sometime it is possible to find an image.
I can't detect it with the code above.
Parsing the framework this way:
trs
item2
cells
item13
innerhtml
I can found inside the value of that innerhtml an item:
VBA Code:
title = Image07
That is the info I need for any row of the table, answering the question: is there the Image07? (Yes/No).
How can I figure it out?