Export to queries to Excel

L

Lee

I have two queries that I want to export to the same new
Excel workbook, each on a separate worksheet. I currently
have it set up so that a user can click on a form button
and export the first query. I can do it by simply
clicking on the 2nd query after the first has been
exported and using File/Export; it adds a new page the
worksheet to the workbook. But I cannot figure out how to
do this programmatically. Is there a way to do this?
 
J

Jake

Lee,

Here is how to export programmatically (watch for line
wrapping...this should be one line).

Docmd.TransferSpreadsheet
acExport,acSpreadsheetTypeExcel9,"qryName","C:\MyFile.xls"


HTH,

Jake
 

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