Read information inside html

S_White

New Member
Joined
May 8, 2017
Messages
25
Hello :)
I have this URL: Candriam Equities L Australia Class C AUD Cap, LU0078775011:AUD historical prices - FT.com. Using Chrome I can inspect the elements and there I need to be able to read the information about symbol=3280 from data-module-name="HistoricalPricesApp" I've tried various ways, but without any luck.

So far my code is:
VBA Code:
Dim XMLHTTP As New MSXML2.XMLHTTP, HtmlDoc As New HTMLDocument, TableObj As Object
With XMLHTTP
    .Open "GET", "https://markets.ft.com/data/funds/tearsheet/historical?s=LU0078775011:AUD", False
    .send
    HtmlDoc.body.innerHTML = .responseText
End With
Set TableObj = HtmlDoc.getElementsByTagName("table")
but I suppose the information about the symbol is outside the table?

Anyone who can assist?

/S_White
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
If it is just a case of pulling in the historical prices table use the option in excel under Data , Get DATA select from web , input your webpage address and select the table you need, you can edit it before loading to your webpage
 
Upvote 0
Well, as the information might be outside the table, I'm looking for a way where I can get the information.
symbol.JPG

It's the "symbol":"3280" information I'm trying to scrape.
 
Upvote 0
Does this get what you want?
VBA Code:
Public Sub Get_Attribute_Value()
    
    #If VBA7 Then
        Dim XMLHTTP As New MSXML2.XMLHTTP60
    #Else
        Dim XMLHTTP As New MSXML2.XMLHTTP
    #End If
    Dim HTMLdoc As New HTMLDocument
    Dim div As HTMLDivElement
    
    With XMLHTTP
        .Open "GET", "https://markets.ft.com/data/funds/tearsheet/historical?s=LU0078775011:AUD", False
        .send
        HTMLdoc.body.innerHTML = .responseText
    End With
    
    Set div = HTMLdoc.querySelector("[data-module-name='HistoricalPricesApp']")
    Debug.Print div.getAttributeNode("data-mod-config").NodeValue
    
End Sub
{"inception":"1997-06-27T00:00:00Z","symbol":"3280"}
 
Upvote 0
Solution
John,

Thanks a $,$$$,$$$ - sorted!

I must admit that I haven't used the 'querySelector' before, but from debugging the output I can see what a difference it makes.

Cheers

S_White
 
Upvote 0

Forum statistics

Threads
1,223,244
Messages
6,170,976
Members
452,372
Latest member
Natalie18

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