J
jgalt650-excel
I'm trying to find a way to pull rss feeds into excel, and attempting
to use querytable.add to do so. What I'm finding is that it's possible,
but that all of the "columns" of the feed are returned. I'd only like
to see a few of the columns. I'm wondering if the sqlstring: concept
will work for the querytable object, or if there might be another way
to specify which columns to return. Any feedback would be much
appreciated.
Sub rssY()
Dim qt As QueryTable
Dim j As Integer
Dim tickerstring, connectstring, sqlstring As String
tickerstring = localconcat(Range("tickers"), ",")
connectstring = "URL;http://finance.yahoo.com/rss/headline?s=" &
tickerstring
' sqlstring = "select () from /rss" (can't figure out how to make this
work)
With ActiveSheet.QueryTables.Add(Connection:=connectstring,
Destination:=ActiveSheet.Range("tickers").Offset(0, 3)) ',
Sql:=sqlstring)
.Name = "R1"
.RefreshStyle = xlOverwriteCells
.WebSelectionType = xlSpecifiedTables
.AdjustColumnWidth = False
.TextFileStartRow = 10
.Refresh
End With
End Sub
to use querytable.add to do so. What I'm finding is that it's possible,
but that all of the "columns" of the feed are returned. I'd only like
to see a few of the columns. I'm wondering if the sqlstring: concept
will work for the querytable object, or if there might be another way
to specify which columns to return. Any feedback would be much
appreciated.
Sub rssY()
Dim qt As QueryTable
Dim j As Integer
Dim tickerstring, connectstring, sqlstring As String
tickerstring = localconcat(Range("tickers"), ",")
connectstring = "URL;http://finance.yahoo.com/rss/headline?s=" &
tickerstring
' sqlstring = "select () from /rss" (can't figure out how to make this
work)
With ActiveSheet.QueryTables.Add(Connection:=connectstring,
Destination:=ActiveSheet.Range("tickers").Offset(0, 3)) ',
Sql:=sqlstring)
.Name = "R1"
.RefreshStyle = xlOverwriteCells
.WebSelectionType = xlSpecifiedTables
.AdjustColumnWidth = False
.TextFileStartRow = 10
.Refresh
End With
End Sub