Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get data from iframe and table

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
425
IT

table inside frame, never used!!!

how to get data in table?

See image attached


MY TEST code:
Code:
Option Explicit
Sub TEST()

Dim http As New MSXML2.XMLHTTP60, html As New HTMLDocument
Dim topics As Object, topic As Object, posts As Object, post As Object, hd As Object
Dim x As Long, y As Long, z As Long

x = 2
y = 2
z = 2

With http
    .Open "GET", "[URL unfurl="true"]https://coseerobe.gbvitrano.it/comuni-italiani-2021.html",[/URL] False
    .send
    html.body.innerHTML = .responseText
End With

Set topics = html.getElementsByTagName("table")

 For Each topic In topics
    For Each posts In topic.getElementsByTagName("tr")
        For Each post In posts.getElementsByTagName("td")
            Set hd = posts.getElementsByTagName("td")(0)
            Debug.Print hd.innerText
            Cells(z, 1) = hd.innerText
            Cells(x, y) = post.innerText
            Debug.Print post.innerText
            y = y + 1
        Next post
        y = 2
        x = x + 1
        z = z + 1
    Next posts
 Next topic
 
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top