Export Query to Excel

A

AJOLSON

I am exporting a query to excel using the following code:
DoCmd.OutputTo acOutputQuery, "AllOut", acFormatXLS, , True

It creates a new excel file called AllOut and places the information in a
worksheet that it names AllOut. Where that works I would like to take this
to the next level and just cant.

What I would like to do is when the query is exported I want the query
exported to a excel file that has already been created. Specifically I would
like the query to open up that pre-determined file and place the results of
the query in a specified worksheet within the excel file. And if at all
possible I would like it to place it in a pre-determined row or cell within
that worksheet, although the last is not that critical.

Any help would be appreciated

Thanks
Andy
 
R

Roger Carlson

You would have to use Office Automation for that. But here's an
alternative. Use the TransferSpreadsheet method to send your query to an
existing excel file in a new tab and then (in Excel) link the values from
the new tab into the cells you want. It's kind of a semi-automation method.

On my website (www.rogersaccesslibrary.com), is a small Access database
sample called "ExportToExcel.mdb" which illustrates how to do this. You can
find it here:
http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=350.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 

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