rdone
Apr 21 2004, 06:50 PM
I need to export multiple Access tables from the same DB to an Excel workbook. Ideally, the tables would be different worksheets in the same workbook. Even more ideally, the process would be possible using a macro that I could attach to a button on an Access form. Is this possible and how?
rdone
Apr 21 2004, 10:37 PM
Thanks! This looks like what I need. I will have at it and post any revisions.
rdone
Apr 26 2004, 10:47 PM
First, I have to say that this place rocks out loud. Second, here is another take on exporting an Access table to an Excel workbook, where 8 references Excel versions 8-10, TABLENAME is the table you want to export, and EXCELWORKBOOKNAME is the destination workbook. Additional exports to the same workbook will be added as subsequent worksheets.
Function Copy_Data_to_Excel()
On Error GoTo Copy_Data_to_Excel_Err
DoCmd.Echo False, "Exporting data..."
DoCmd.TransferSpreadsheet acExport, 8, "TABLENAME", "c:\EXCELWORKBOOKNAME", True, ""
DoCmd.Echo True, ""
MsgBox "The data were exported.", vbInformation, "Data Exported"
Copy_Data_to_Excel_Exit:
Exit Function
Copy_Data_to_Excel_Err:
MsgBox Error$
Resume Copy_Data_to_Excel_Exit
End Function