html - How to use VBA for web parsing table with data-reactid -
i trying parse each element table website, however, table reference data-reactid, question how use .document.getelementsbyxxx parse each element?
'vba table data tblnamearr = array(worksheets("sheet1").cells(2, 4), worksheets("sheet1").cells(3, 4), worksheets("sheet1").cells(4, 4), worksheets("sheet1").cells(5, 4)) tblstartrow = 6 set elemcollection = ie.document.getelementsbytagname("table") t = 0 elemcollection.length - 1 r = 0 (elemcollection(t).rows.length - 1) c = 0 (elemcollection(t).rows(r).cells.length - 1) activesheet.cells(r + tblstartrow, c + 1) = elemcollection(t).rows(r).cells(c).innertext next c next r activesheet.cells(r + tblstartrow + 2, 1) = tblnamearr(t) tblstartrow = tblstartrow + r + 4 next t
the link website need parse:
Comments
Post a Comment