Exporting Multiple Queries from Access into Excel

R

Rob

Is this possible? It may sound like a daft question, but I
am exporting three queries from Access into Excel... at
present each is exported to a seperate excel spreadsheet.
Is it possible to export them all to three seperate
worksheets within the same spreadsheet. I don't want to go
down the route of union queries and exporting the data en
masse to a single sheet, I need to export them seperately.

Any advice appreciated :)
 
J

John Nurick

Hi Rob,

It's possible but as far as I know undocumented. Use
DoCmd.TransferSpreadsheet or the TransferSpreadsheet macro action, and
include the sheet name you want as the "Range" argument, e.g.

Docmd.TransferSpreadsheet acExport, _
acSpreadsheetTypeExcel9, "MyQuery1", _
"D:Folder\File.xls", True, "MyQuery1"

Then repeat with the same filename but the other queries and sheet
names.
 
R

Rob

Thanks very much John, help much appreciated :)
-----Original Message-----
Hi Rob,

It's possible but as far as I know undocumented. Use
DoCmd.TransferSpreadsheet or the TransferSpreadsheet macro action, and
include the sheet name you want as the "Range" argument, e.g.

Docmd.TransferSpreadsheet acExport, _
acSpreadsheetTypeExcel9, "MyQuery1", _
"D:Folder\File.xls", True, "MyQuery1"

Then repeat with the same filename but the other queries and sheet
names.


Is this possible? It may sound like a daft question, but I
am exporting three queries from Access into Excel... at
present each is exported to a seperate excel spreadsheet.
Is it possible to export them all to three seperate
worksheets within the same spreadsheet. I don't want to go
down the route of union queries and exporting the data en
masse to a single sheet, I need to export them seperately.

Any advice appreciated :)

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
.
 

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