显示我必须从http://www.idealo.de/preisvergleich/OffersOfProduct/143513.html最后一列不从表
得出价格表到目前为止,我已经做到了这一点代码
Sub test()
Set sht = Sheets("Tabelle4")
rCount = 1
Dim objIE As Object, objTbl As Object, objTR As Object
Set objIE = CreateObject("InternetExplorer.application")
With objIE
.Visible = True
.Navigate "http://www.idealo.de/preisvergleich/OffersOfProduct/143513.html"
Do While .Busy Or .ReadyState <> 4
DoEvents
Loop
Set objTbl = objIE.Document.getElementById("offers-list")
Set objTR = objTbl.getElementsByTagName("tr")
rCount = 1
On Error Resume Next
For Each td In objTR
Cells(rCount, 1) = td.all(0).outerText
Cells(rCount, 2) = td.all(4).innerText
'Cells(rCount, 3) = td.all(2).outerText
'Cells(rCount, 4) = td.all(3).outerText
'Cells(rCount, 6) = td.all(5).innerText
'Cells(rCount, 7) = td.all(6).innerText
rCount = rCount + 1
Next
On Error GoTo 0
End With
objIE.Quit
Set objIE = Nothing
End Sub
它给了我前两列,但包含的最后一列店名不显示。任何人都可以帮助哪一个是最后一列的td()
你为什么要使用VBA这种情况的TD对象?一个简单的Data | From Web可以为你提供你想要的一切吗?你可能想看看[2]使用Excel的内置设施从网络获取数据](http://stackoverflow.com/questions/8798260/html-parsing-of-cricinfo-scorecards/8846791#8846791)我刚试过它的工作原理。 –
@SiddharthRout我需要开发一个价格比较工具,这就是为什么在上面的链接中使用vba – user3305327
的情况,还有vba代码。 –