Export multiple queries to multiple Sheets in Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using the TransferSpreadsheet function in vba to export a query to an
Excel file.
I have 5 queries that I would like to export (via vba) to 5 separate Sheets
in a single Excel file. I want the User to be able to click a single button
on a form and have the 5 queries exported to the single Excel file. Anyone
have a sample code for this?
 
You can use the Range argument of the TransferSpreadsheet method to do this.
Although Help says it will fail, it will not. It does work:

DoCmd.TransferSpreadsheet acExport, 3, _
"Employees","C:\Lotus\Newemps.wk3", True, "MyWorksheetName"
 
Back
Top