Output Query Results To Excel

M

Matt

Hi All,

I am currently outputting the results of a query to an Excel Workbook
using the following line of code:


DoCmd.OutputTo acOutputQuery, queryName, acFormatXLS, , True


What this is doing is asking the user where to specify where the file
will be saved and then opens the file. What I would like to do is to
just open a new workbook without asking the user to specify the file
save. It would be like opening excel and pasting the results of the
query in ... if the user wants to save they can later.


As always, thanks in advance for any help!
 
D

Damon Heron

Check out the CreateObject function in help. This will open an excel
worksheet. Then you could design a loop to go thru your data from the query
and paste it into the cells on the worksheet. That way, the user will have
the option of saving or discarding the sheet.

Damon
 

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