Full Version: Export Access Table to Excel Workbook
UtterAccess Discussion Forums > Microsoft® Access > Access Tables + Relationships
rdone
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?
TimK
Check this POST out.

smile.gif
rdone
Thanks! This looks like what I need. I will have at it and post any revisions.
TimK
Great.

smile.gif
rdone
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
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.