Sometimes we need to extract some stock price related info from website to Excel worksheet. Here is the VBA Code to extract info from Yahoo Finance:
Sub getInfoOnine()
Dim qt As QueryTable
Set qt = ActiveSheet.QueryTables.Add(Connection:="Url;http://finance.yahoo.com/q?s=infy", Destination:=Range("B2"))
With qt
.Name = "Getting online data"
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingAll
.WebTables = "1,2,3"
.EnableRefresh = True
.RefreshPeriod = 10
.Refresh
End With
End Sub
Sub getInfoOnine()
Dim qt As QueryTable
Set qt = ActiveSheet.QueryTables.Add(Connection:="Url;http://finance.yahoo.com/q?s=infy", Destination:=Range("B2"))
With qt
.Name = "Getting online data"
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingAll
.WebTables = "1,2,3"
.EnableRefresh = True
.RefreshPeriod = 10
.Refresh
End With
End Sub
hey nice source for me,thanks for sharing the nice ideas and thought of the extract the data from the website and you have done a incredible work in the blog to collect the code and this blog provide amazing information and i have to sure bookmark this blog.
ReplyDeleteextract data from web