Export to queries to Excel

  • Thread starter Thread starter Lee
  • Start date Start date
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?
 
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
 
Back
Top