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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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