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: 13

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Watch MrExcel Video

Forum statistics

Threads
1,129,402
Messages
5,636,078
Members
416,896
Latest member
Hozier

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
Top