Export data to Excel

polina

Registered User.
Local time
Today, 23:47
Joined
Aug 21, 2002
Messages
100
Hi,

I was wondering if anyone knows how to export different tables to one excel workbook, putting each table into separate sheet within the book.

Thanks.
 
You can do this with the TransferSpreadSheet command.
 
Pat,

Using the docmd.TransferSpreadSheet you can send Tables/Queries to the Same SpreadSheet but a different WorkSheet.

Of course Each table/query has to have a different name or it will overwrite the existing one.

Example:

Code:
Public Sub TransToSpreadsheet()

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Students", CurrentProject.Path & "\MySpreadSheet.xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Students And Classes", CurrentProject.Path & "\MySpreadSheet.xls"

End Sub
 

Users who are viewing this thread

Back
Top Bottom