顯示我必須從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代碼。 –