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.