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 !
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hi,

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

Thanks,
Saurabh
 

Attachments

  • historicaldataforBitCoin.PNG
    historicaldataforBitCoin.PNG
    76.6 KB · Views: 12
Upvote 0
Hello Saurabh,

Yes! As a matter of fact, I only need the 1st 2 lines. But that would do the trick.
 
Upvote 0
Hi, the historical data is not opening in Internet Explorer and thus unable to extract the required information.
 
Upvote 0
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 ?
 
Upvote 0
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
 
Upvote 0
Well, thanks anyway...

Maybe someone will have any idea...

Have a nice day :)
 
Upvote 0

Forum statistics

Threads
1,214,587
Messages
6,120,405
Members
448,958
Latest member
Hat4Life

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