exporting table

N

nzquikster

How can i use vba to export a table as an excel spreadsheet and save it with
a specific name
 
J

Jerry Whittle

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top