View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Excel MVP Don Guillett Excel MVP is offline
external usenet poster
 
Posts: 168
Default Why do I have to restart Excel when ActiveSheet.QueryTables.Addfails? Options

On Dec 18, 3:07*pm, Frank wrote:
I had posted this question a few weeks ago but got no answer so I am
reposting it again.

Original post:

So that you know, I’ve looked on various fora but except for the fact
that Excel 2007 seems not to have this problem, I could not find an
answer for previous versions of Excel.

Here is my query:

With ActiveSheet.QueryTables.Add(Connection:="TEXT;http ://
ichart.finance.yahoo.com/table.csv?s=BLABLABLA&ignore=.csv",
Destination:=Range("A1"))
* * .RefreshStyle = xlOverwriteCells
* * .TextFileCommaDelimiter = True
* * .TextFileColumnDataTypes = Array(1, 9, 9, 9, 1, 9, 9)
* * .Refresh BackgroundQuery:=False
End With

Obviously BLABLABLA is not a valid ticker symbol but occasionally,
even with a valid ticker symbol, the query fails, for example, if
Yahoo! Finance website or the internet connection is down.

Once a query fails, I need to shut Excel down to start a valid query.

I cannot verify that the problem does not occur with Excel 2007 (I
still use 2003).

My questions a
Does having 2007 solve the problem?
Is there a workaround for previous versions of Excel?

Thanks


I tested your macro in xl2003 with no problem and see no reason to
think that xl2007 would be different.
What is the error msg? You could try using an on error resume next

Why are you getting the actual close instead of the adjusted close?
Date Open High Low Close Volume Adj Close
1/2/1962 578.5 578.5 572 572 387200 2.62