最后一列未显示在表格中

时间:2022-05-11 08:04:16

I have to derive the price table from http://www.idealo.de/preisvergleich/OffersOfProduct/143513.html

我必须从http://www.idealo.de/preisvergleich/OffersOfProduct/143513.html得出价格表。

So far I have done this code

到目前为止,我已完成此代码

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

It gives me first two column but the last column that contains the shop name is not displaying. Can any one help which one is the td() of the last column

它给我前两列,但不显示包含商店名称的最后一列。任何人都可以帮助哪一个是最后一列的td()

1 个解决方案

#1


0  

In order to figure what type of data each td object has you have to add them to the watch. For example:

为了确定每个td对象具有哪种类型的数据,您必须将它们添加到手表中。例如:

最后一列未显示在表格中

最后一列未显示在表格中

最后一列未显示在表格中

As you can see, in the td object I am watching i can tell that the value of

正如你所看到的,在我看的td对象中,我可以看出它的价值

td.all.item(0).innertext 

is: Canon Nah­linse 500D 72 mm

是:佳能Nahlinse 500D 72毫米

Now you should go through the other values in the watch window until you can find the index of the shop in the td object

现在,您应该查看监视窗口中的其他值,直到您可以在td对象中找到商店的索引

#1


0  

In order to figure what type of data each td object has you have to add them to the watch. For example:

为了确定每个td对象具有哪种类型的数据,您必须将它们添加到手表中。例如:

最后一列未显示在表格中

最后一列未显示在表格中

最后一列未显示在表格中

As you can see, in the td object I am watching i can tell that the value of

正如你所看到的,在我看的td对象中,我可以看出它的价值

td.all.item(0).innertext 

is: Canon Nah­linse 500D 72 mm

是:佳能Nahlinse 500D 72毫米

Now you should go through the other values in the watch window until you can find the index of the shop in the td object

现在,您应该查看监视窗口中的其他值,直到您可以在td对象中找到商店的索引