• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA: WebScraping to pull data using <ul, <li, <div, <span tags.

RSHA

New Member
Hi All, Can any one help in this vba code. I need to pull <div class codes which are highlighted in yellow color in the Html code to excel file. The out put that is need is listed below.

64238
Code:
Sub GetDat()
    Dim IE As New InternetExplorer, html As HTMLDocument
    Dim elem As Object, data As String

    With IE
        .Visible = True
        .navigate "https://MYURL/sc/wo/WO/index?id=76888564"
        Do While .readyState <> READYSTATE_COMPLETE: Loop
        Set html = .document
    End With

    data = ""

    For Each elem In html.getElementsByClassName("simple-list")(0).getElementsByTagName("li")
        data = data & " " & elem.innerText
    Next elem

    Range("A1").Value = data

    IE.Quit
End Sub

The out put that i need should be like below table.

DateFeedback
3 Dec 13 2016 23:30 CST At this time the work order has been updated to a billable status. Your company can process an invoice against the work order. For any questions regarding invoicing, refer to the Invoice instructions on the Help Link in
2 Dec 11 2016 02:15qStatus changed by auto-update procedure.
1 Dec 01 2016 01:51 CST Auto Dispatch summary sent to divisionsinc.com on Dec 01, 2016 02:50 EST


Thanks for you help,
Rsha
 

Marc L

Excel Ninja
Hi, to search an element by its class obviously use the getElementsByClassName method …​
 

RSHA

New Member
Hi Marc L, but I am not able to pull the div class codes with this micro file. Any suggestions from your side to pull that highlighted class codes
 
Top