Not sure if this is possible by using a Macro.
It can easily be done by using a VBA procedure.
Sub ExportExcel()
' "Range" is a named Range defined in a worksheet of the Excel workbook
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Table", "File", True, "Range"
End Sub