MS Query

T

Tom Ulincy

I recorded a procedure that includes a query (MS Query,
Excel 2002) to an external data source. The result set is
returned to a sheet in the workbook. How do you change,
or better yet, programmatically specify, the destination
path for the result set? Right now, if I move the
workbook to another folder, the query fails.

Thanks for your help.
Tom
 
D

Dick Kusleika

Tom

That shouldn't happen normally. The external data source is hardcoded (full
path) into the QueryTables Connection and CommandText properties. The
destination of the result set is a Range object stored in the Destination
property. When you add a QueryTable, you use the QueryTables property of
the Worksheet object.

Sheet1.QueryTables.Add ...

So it shouldn't matter where the you run this code, it will always go to
Sheet1 of the ActiveWorkbook. Post the code that you are using and the
exact error message.
 

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