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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get flag and state name

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
411
0
16
IT

how to get for each state, the related image, and store all in c:\mydir
tks

My poor code for loop in cell of table:

Code:
Option Explicit
Sub test()
    
    Dim oDom As Object: Set oDom = CreateObject("htmlFile")
    Dim X As Long, Y As Long
    Dim oRow As Object, oCell As Object
    Dim data() As Variant
    
    Y = 1: X = 1
    
    With CreateObject("msxml2.xmlhttp")
        .Open "GET", "[URL unfurl="true"]https://www.comuniecitta.it/prefissi-internazionali",[/URL] False
        .Send
        oDom.body.innerHtml = .responseText
    End With
    
    With oDom.getElementsByTagName("table")(0)
        
        ReDim data(1 To .Rows.Length, 1 To .Rows(1).Cells.Length)
        
        For Each oRow In .Rows
            For Each oCell In oRow.Cells
                data(X, Y) = Trim(oCell.innerText)
                Debug.Print oCell.innerText
                Y = Y + 1
            Next oCell
            Y = 1
            X = X + 1
            
        Next oRow
        
    End With

End Sub
 
Why are you over-engineering solutions? Just save the web page from your browser. All those icons should be saved with the HTML. They are named with their ISO country codes.

And of course, follow copyright laws with whatever crime you intend with this stolen data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top