SOLVED by KUMAR
SOLVED by KUMAR
Last edited by rolex; 04-14-2015 at 06:05 AM.
Could you give me website link and table name...I will give you code which fetch out data without query connection.
Lokesh Kumar
Stay Hungry.. Stay Foolish..
_________________________________________________________
Please Click STAR to Add Reputation if my/someone's answer helped!
Getting tickers to excel
Last edited by rolex; 04-14-2015 at 06:05 AM.
getting tickers to excel from websites
Last edited by rolex; 04-14-2015 at 06:05 AM.
Hi,
Could you please just try the following code
Here is your attachement..Tickers.xlsm![]()
Const URl As String = "http://www.netfonds.no/quotes/about.php?paper=" Sub Tickers() Dim xmlHttp As Object Dim html As HTMLDocument Dim MarketValue As Variant Set xmlHttp = CreateObject("MSXML2.ServerXMLHTTP.6.0") For i = 2 To Range("B1000").End(xlUp).Row xmlHttp.Open "GET", URl & Cells(i, 2), False xmlHttp.setRequestHeader "Content-Type", "text/xml" xmlHttp.send Set html = New MSHTML.HTMLDocument html.body.innerHTML = xmlHttp.ResponseText MarketValue = html.getElementsByClassName("right")(2).innerText Cells(i, 3) = MarketValue Next i End Sub
If your question is resolved, mark it SOLVED using the thread tools. Click on the star if you think some-1 helped you.
Thank you! It looks such short script making more than the one I tried to create which is nowhere near.
I really appreciate your help, was doing it for along time but now I can see how it should have been done.
Click on the star if you think some-1 helped you.in this case its me.......
Hey
Use the following code....
I tried to send you msg......
![]()
Const URl As String = "http://www.netfonds.no/quotes/about.php?paper=" Sub Tickers() Dim xmlHttp As Object Dim html As HTMLDocument Dim MarketValue As Variant Set xmlHttp = CreateObject("MSXML2.ServerXMLHTTP.6.0") For i = 2 To Range("B1000").End(xlUp).Row On Error Resume Next xmlHttp.Open "GET", URl & Cells(i, 2), False xmlHttp.setRequestHeader "Content-Type", "text/xml" xmlHttp.send Set html = New MSHTML.HTMLDocument html.body.innerHTML = xmlHttp.ResponseText MarketValue = html.getElementsByClassName("right")(2).innerText If Err.Number = 91 Then Cells(i, 3) = "Incorrect Ticker/Record not Found" Else Cells(i, 3) = MarketValue End If Next i End Sub
Hi
There is an error since you have not added the following library:-
Tools->References->Microsoft HTML Object Library...
I have attached the file after adding the library....hope it will work fine at your end.
here is your attachment...Tickers.xlsm
Cheers....
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks