(Solved) – How to Scrape from nestled Divs using VBA


HTML code from website

Hi All,

I am trying to write a web scraper to scrape information and ultimately download files hosted on the site (although I do not think I will solve this issue here. It is BIM360, an Autodesk site that hosts files and information relevant to the files. Here is what I have so far: it opens the website but then I met with error 924. I think this is because there are nestled divs as per the picture. I have highlighted what I am trying to scrape initially in the picture, I then wish it to loop down the page and do this for each document. Thanks in advance for any help.

Sub GetIEValues()
Dim ie As InternetExplorer
Set ie = New InternetExplorerMedium
Dim dd As Variant

Set ie = CreateObject("InternetExplorer.Application")

With ie
    .Visible = True
    .navigate "https://docs.b360.eu.autodesk.com/projects/f0c33551-e503-4f82-afe8-de994c61b880/reviews"

    Application.Wait (Now   TimeValue("0:00:016"))

        Loop Until ie.readyState = READYSTATE_COMPLETE

    With ThisWorkbook.Worksheets(1)
        lRow = .Cells(.Rows.Count, "B").End(xlUp).Row   1
        .Cells(lRow, "A").Value = Now()
        .Cells(lRow, "B").Value = .document.getElementsByClassName("EllipsisText MatrixTable__row-cell-text")(0).innerText
        .Cells(lRow, "C").Value = .document.getElementsByClassName("EllipsisText MatrixTable__row-cell-text")(1).innerText
        .Cells(lRow, "D").Value = .document.getElementsByClassName("EllipsisText MatrixTable__row-cell-text")(2).innerText
        .Cells(lRow, "E").Value = .document.getElementsByClassName("EllipsisText MatrixTable__row-cell-text")(3).innerText
        .Cells(lRow, "F").Value = .document.getElementsByClassName("EllipsisText MatrixTable__row-cell-text")(4).innerText
    End With
End With

End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *