Excel VBA Load Data from HTML Website without CreateObject("InternetExplorer.Application")

Silent_Warrior5

New Member
Joined
Aug 11, 2018
Messages
4
Hi all,



i will load data from a html website. the problem is i can not use "CreateObject("InternetExplorer.Application")" because the site don't load in the internet explorer. In Firefox the side works.

i need all data in the blue boxes from all 4 Areas



i test it with getElementsByTagName and getElementById but dont work



can someone help me?



VBA Code:
Sub Extract_data()

    Dim url As String, links_count As Integer
    Dim i As Integer, j As Integer, row As Integer
    Dim XMLHTTP As Object, html As Object
    Dim tr_coll As Object, tr As Object
    Dim td_coll As Object, td As Object

    links_count = 1
    For i = 0 To links_count

        url = ""

        Set XMLHTTP = CreateObject("MSXML2.XMLHTTP")
        XMLHTTP.Open "GET", url, False
        XMLHTTP.send

        Set html = CreateObject("htmlfile")
        html.body.innerHTML = XMLHTTP.responseText

        Set tbl = html.getElementsByTagName("location-container")

        Set tr_coll = tbl(0).getElementsByTagName("TD") 

        For Each tr In tr_coll
            j = 1
            Set TD_col = tr.getElementsByTagName("TD")

            For Each td In TD_col
                Cells(row + 1, j).Value = td.innerText
                j = j + 1
            Next
            row = row + 1
        Next
    Next

    MsgBox "Done"
End Sub




thx and cheers

silent
 

Attachments

  • help excel.jpg
    help excel.jpg
    192.5 KB · Views: 39

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top