Hi,
From the following link I would like to extract Sector and Industry. Can anyone help me out with the code.
https://finance.yahoo.com/quote/AMZN/profile?p=AMZN
Hi,
From the following link I would like to extract Sector and Industry. Can anyone help me out with the code.
https://finance.yahoo.com/quote/AMZN/profile?p=AMZN
Cheers!
Deep Dave
Try this;
Sub Test() ' Haluk - 15/03/2020 ' [email protected] ' Dim HTTP As Object, HTML As Object, i As Integer myURL = "https://finance.yahoo.com/quote/AMZN/profile?p=AMZN" Set HTML = CreateObject("HTMLFILE") Set HTTP = CreateObject("MSXML2.XMLHTTP") HTTP.Open "GET", myURL, False HTTP.send HTML.body.innerHTML = HTTP.responseText Set objCollection = HTML.getElementsByTagName("span") i = 0 Do While i < objCollection.Length If objCollection(i).classname = "Fw(600)" Then If objCollection(i).getAttribute("data-reactid") = 21 Then xSector = objCollection(i).innerText ElseIf objCollection(i).getAttribute("data-reactid") = 25 Then xIndustry = objCollection(i).innerText ElseIf objCollection(i).getAttribute("data-reactid") = 29 Then xEmployees = objCollection(i).innerText End If End If i = i + 1 Loop MsgBox "Sector = " & xSector & vbCrLf & _ "Industry = " & xIndustry & vbCrLf & _ "Num. of Employees = " & xEmployees Set HTML = Nothing Set HTTP = Nothing End Sub
Hi Haluk,
Thank you very much.. It helped a lot, and sorry for the late reply..
Cheers!
Hi,
Did you know about the newer Data Types built into Excel that might give you what you want? See:
https://www.excelforum.com/excel-pro...o-finance.html
One test is worth a thousand opinions.
Click the * Add Reputation below to say thanks.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks