Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to extract the data from the webpage http://www.fdci.org/Member.aspx?mid=-1634884325&cat=1 and many others similar to this.

I need to get the Profile, Name, Address, Email, phone,fax, etc. from the webpage to different columns of an excel sheet. Would be great if you can share the VBA code for this or any help would be welcome.

PS: I am new to VBA Coding.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
176 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can use MSXML2.XMLHTTP60 to get page, example for address.

' Add reference to MS XML, v6.0 and MS HTML Object Library

Public Sub test()

    Dim xmlObject As New MSXML2.XMLHTTP60
    Dim htmlDocumentObject As Object

    With xmlObject
        Call .Open("GET", "http://www.fdci.org/Member.aspx?mid=-1634884325&cat=1", False)
        Call .send

        If (.Status = 200) Then
            Set htmlDocumentObject = New HTMLDocument
            htmlDocumentObject.Open
            htmlDocumentObject.write .responseText
            htmlDocumentObject.Close

            Dim address As String
            address = htmlDocumentObject.getElementById("ctl00_ContentPlaceHolder1_lblAdd1").innerText

            [a1] = address
            ' and so on ...
        End If
    End With
End Sub

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...