Search notes:

Access: DoCmd.TransferSpreadsheet

All parameters are optional:
DoCmd.TransferSpreadsheet (TransferType, SpreadsheetType, TableName, FileName, HasFieldNames, Range, UseOA)
TransferType is either acExport, acImport or acLink, the default is acImport.
SpreadsheetType is a member of the acSpreadsheetType enumeration. In the year 2022, in most cases, I think, acSpreadsheetTypeExcel12Xml will be used.
If HasFieldNames defaults to false. With true when importing a spreadsheet, it is assumed to have a header row with the column names, when exporting, such a header row will be created.
Range is only used when importing data and specifies the source range from where data is imported.
The value of UseOA is not supported.
Export contracts table to an Excel Workbook named contracts.xlsx.
doCmd.transferSpreadsheet acExport, acSpreadsheetTypeExcel12XML, "contracts", environ("TEMP") & "\contracts.xlsx", true

See also

Transfer… methods of the DoCmd object.

Index