View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected][_2_] no.reply7@comcast.net[_2_] is offline
external usenet poster
 
Posts: 6
Default Query fails, requiring excel to be closed and restarted

I am using following query:

With ActiveSheet.QueryTables.Add(Connection:= "TEXT:my_query",
Destination:=ActiveCell)
.SaveData = True
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 9, 9, 9, 9, 9, 1)
.Refresh BackgroundQuery:=False

It works fine unless the query fails. At that point, when running a
subsequent valid query, I get the following error message:

Microsoft Office Excel cannot access the file etc...
There are several possible reasons:
The file name or path does not exist
The file is being used by another program
The workbook you are trying to same has the same name as a currently
open workbook

I have to to shut excel down to make the query work again. If I only
close and reopen, the query still fails.

I've search for the problem but found not workable solution.

Any thoughts?

Thanks.