MSQUERY via VBA

H

Howie

Is there a way to initiate MSQUERY via VBA then capture
the info on exiting so that I can insert the query results
into spreadsheet - also via VBA.
 
D

Dick Kusleika

Howie

Use the Add method of the QueryTables collection. Check VBA help for the
syntax.

In order to get all the arguments you need for that method, the easiest
thing to do is to create a query manually (Data - Get External Data). Then
go to the immediate window and type this

?Sheet1.QueryTables(1).CommandText
?Sheet1.QueryTables(1).Connection

If you get stuck, post back.
 

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