exporting table

  • Thread starter Thread starter nzquikster
  • Start date Start date
N

nzquikster

How can i use vba to export a table as an excel spreadsheet and save it with
a specific name
 
Function fExportExcel()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qryA",
"n:\qryA.xls", True
'DoCmd.OutputTo acOutputQuery, "qryA", acFormatXLS, "n:\qryA.xls"
End Function

Two options above. The OutputTo is commented out. Both have stengths and
weaknesses.

qryA is the name of a query, but it can also be a table.

n:\qryA.xls is the name of the Excel spreadsheet and where it will go. With
a little work you can do things like append a data/time stamp to the file
name.
 
Back
Top