I keep getting this message ("'A query with this name already exists on this sheet") even though I am deleting all visible queries within this workbook. How can I delete all external data queries so that this error does not occur? Thanks.
Printable View
I keep getting this message ("'A query with this name already exists on this sheet") even though I am deleting all visible queries within this workbook. How can I delete all external data queries so that this error does not occur? Thanks.
I can't rerun the same data import query without either manually renaming the query within the properties window or deleting the worksheet. No matter what I try I cannot see the query anywhere, but its name contains the name of the text file I imported.
More info. Seems like if you delete the external data query after you run it, you can run the same query to the same external file again. But if you save the workbook without deleting the query, that query stays forever and cannot be found and deleted unless you delete the entire sheet.
Run this to delete all queries on the active sheet:
Code:While ActiveSheet.QueryTables.Count
ActiveSheet.QueryTables(1).Delete
Wend