Martin Griffiths
Martin Griffiths

Reputation:

Exporting Access table data to Excel

I have a table in Access 2007 with 11,000 rows and about 20 columns. I want to create a form button that exports the table to an Excel sheet. The code need to be VBA.

Any Ideas?

Upvotes: 1

Views: 580

Answers (2)

BIBD
BIBD

Reputation: 15414

Here's an example.

    DoCmd.TransferSpreadsheet acExport, _
                                acSpreadsheetTypeExcel8, _
                                "myQuery", _
                                "C:\myDir\myFile.xls", _
                                True

You probably need to make sure that your destination is clear of the output filer (myFile.xls).

Upvotes: 3

AlexCuse
AlexCuse

Reputation: 18316

From access you can also use the TransferSpreadsheet method.

Upvotes: 3

Related Questions