Hi
Downloading stock prices from Yahoo Finance, against a list of stock codes that are valid works fine e.g.
AA, AXP, BA, C, CAT, D etc.
The Query Quote coding used being as follows:
QueryQuote:
With ActiveSheet.QueryTables.Add(Connection:="URL;" & qurl, Destination:=DataSheet.Range("C7"))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With
Range("C7").CurrentRegion.TextToColumns Destination:=Range("C7"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=True, Space:=False, other:=False
Range("C1:I1").Select
Selection.ColumnWidth = 8
Display More
The problem I encounter is if the list of stock codes, include an invalid code (in this example I have used 'VVV', or a stock code that is valid, but is not in the Yahoo database for the specific date that I am downloading, the following a error message is displayed:
Run Time Error 1004 Unable To open
http://chart.yahoo.com/table.c…&a=1&b=3&c=2011&d=1&e=The Internet site reports that the item you requested could not be found (HTTP/1.0 404)
The system stops, and I cannot move forward.
On debugging - .Refresh BackgroundQuery:=False is highlighted.
I would like to be able to add code that would skip any invalid entries such as the above, and which would then access the next valid stock code and download the stock price against this.
Any soultion that anyone could provide would be most appreciated.
Regards
Mike Simmons