Why do I have to restart Excel when ActiveSheet.QueryTables.Add fails?

F

Frank

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=msft&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 are:
Does having 2007 solve the problem?
Is there a workaround for previous versions of Excel?

Thanks
 
F

Frank

ooops. My query was supposed to read:

ActiveSheet.QueryTables.Add(Connection:="TEXT;http://
ichart.finance.yahoo.com/table.csv?s=BLABLABLA&ignore=.csv",
Destination:=Range("A1"))

MSFT is a valid ticker symbol
 
Joined
Sep 23, 2011
Messages
1
Reaction score
0
Hi there,
I have exactly the same problem as you. When my macro crashes on
ActiveSheet.QueryTables.Add, I have to restart Excel to get it to work. Did you figure out a way around this?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top