Retrieving a whole web page from a Query in VBA

Jtable

New Member
Joined
Jan 25, 2021
Messages
4
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I'm trying to get data from a web page that, apparently, is constructed such a way that I don't get all data that appears.
Coinmarketcap historical data

Here's the code I'm using :

VBA Code:
    Const WebQueriesSheet = "Web_Queries"
    Sub TestWeb()
        Send_Query ("URL;https://coinmarketcap.com/currencies/" & "Bitcoin") ' Calls for the web query
    
    End Sub
    
    Sub Send_Query(URL)
    
        Sheets(WebQueriesSheet).Range("A:Z").Delete
        Sheets(WebQueriesSheet).Cells.ClearContents
        With Sheets(WebQueriesSheet).QueryTables.Add(Connection:=URL, Destination:=Sheets(WebQueriesSheet).Range("A1"))
            .WebSelectionType = xlEntirePage
            .WebFormatting = xlWebFormattingNone
            .WebDisableDateRecognition = True
            .WebPreFormattedTextToColumns = True
            .WebConsecutiveDelimitersAsOne = True
            .WebDisableRedirections = False
            .Refresh BackgroundQuery:=False
        End With
        For Each cn In ThisWorkbook.Connections
            cn.Delete
        Next cn
    End Sub

I do not get the historical data. I tried to save the page to an HTML format locally, and, in the file, the data is present, so there must be a way, but I can't seem to find it.

Any idea ?

Thanks !
 

Some videos you may like

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Saurabhj

Active Member
Joined
Jun 6, 2020
Messages
413
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi,

Would you like to extract data as shown in attached file.

Thanks,
Saurabh
 

Attachments

  • historicaldataforBitCoin.PNG
    historicaldataforBitCoin.PNG
    76.6 KB · Views: 7

Jtable

New Member
Joined
Jan 25, 2021
Messages
4
Office Version
  1. 2016
Platform
  1. Windows
Hello Saurabh,

Yes! As a matter of fact, I only need the 1st 2 lines. But that would do the trick.
 

Saurabhj

Active Member
Joined
Jun 6, 2020
Messages
413
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi, the historical data is not opening in Internet Explorer and thus unable to extract the required information.
 

Jtable

New Member
Joined
Jan 25, 2021
Messages
4
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

Well... I just tested, and indeed, not much is showing in IE. But even Microsoft is not recommanding using IE anymore. In Edge, it shows fine.
Is Excel using and IE module to query the Web ?
 

Saurabhj

Active Member
Joined
Jun 6, 2020
Messages
413
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi, I tried in Power Query and Web query also but not showing or retrieving the required information.

Sorry didn't find any solution.

Thanks,
Saurabh
 

Jtable

New Member
Joined
Jan 25, 2021
Messages
4
Office Version
  1. 2016
Platform
  1. Windows
Well, thanks anyway...

Maybe someone will have any idea...

Have a nice day :)
 

Watch MrExcel Video

Forum statistics

Threads
1,127,341
Messages
5,624,111
Members
416,011
Latest member
chengkoonwing

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