Home>

I want to identify the table to which the TVs on this page are compared

IE11
Excel2010
Windows10


I want to get the text of a table by specifying an anonymous table in IE.

There are other tables, so table (0) cannot be obtained.

Tell me how to get the code below because I don't know which table I want to get.

Dim i As Integer
    i = 0
    For Each objTable In objIE.document.getElementsByTagName ("table")
        Debug.Print objTable.Cells (i) .innerText
        i = i + 1
    Next objTable
  • Answer # 1

    widget-comparison0-swipeidwithdivelement childtableI think you can get it if you get it.

    objIE.document.querySelector ("# widget-comparison0-swipe>table")
    How about this?

  • Answer # 2

    Easy to use, select "what number table".
    It is useless if it is a page that changes the number depending on the situation.
    After that, select the text in the header.

  • Answer # 3

    I'm not familiar with HTML operations, but
    "Div id ="result"class ="result""
    Is not available?

    It feels like a table in the result class.

  • Answer # 4

    In response to spookybird's answer ...
    Since there was no "SET" keyword to assign an object, it was solved when I added it.

    Set objTable = objIE.document.querySelector ("# widget-comparison0-swipe>table")

    I'm sorry for the lack of manners.