'Failed to find any tables on the website - VBA MSXML2

I'm trying to fetch some data from a website using MSXML2 library. There are no errors, however the list of elements within tag is 0.

While I use IE, it works, but its much slower and sometimes website doesn't even load.

Edit: I've noticed that website is showing "Loading" page before loaded and I think it might be an issue.

Here is the code:

Sub Test()

Dim Data As Variant
Dim Tables As Object
Dim Website As Object
Dim x As Long, y As Long
Dim oRow As Object, oCell As Object
Dim FirstCol As Integer, LastCol As Integer, FirstRow As Integer, LastRow As Integer

Set Website = CreateObject("htmlFile")
y = 0: x = 0 'X - row, Y - column

With CreateObject("MSXML2.serverXMLHTTP")
    .Open "GET", "www.example.com", False
    .send
    Website.body.innerHTML = .responseText
End With

Set Tables = Website.getElementsByTagName("table")
'And when I go to debug mode and check, there are 0 tables. However, on the website, there are many tables within <table> tag
End Sub
vba


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source