Tuesday, November 29, 2011

Microsoft Access 2007/2010 Exporting tables to Excel

Interesting question:

There is a command in access VBA that's been around for ages called TransferSpreadsheet
Funny enough there are a few variables to do with te format:

acSpreadsheetTypeExcel12 --> this is to export as .xlsb
acSpreadsheetTypeExcel12xml --> This is to export as .xlsx

e.g.:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "MyTable", "c:\temp\MyTable.xlsx", True

acSpreadsheetTypeExcel9 --> This refers to Excel 2000 format . e.g. MyFile.xls


The intellisense doesn't give you a acSpreadsheetTypeExcel10 or acSpreadsheetTypeExcel11 so maybe these don't exist.

##

No comments: