I have tried this syntax
However, I get an error ofCode:DoCmd.TransferSpreadsheet acOutputQuery, acSpreadsheetTypeExcel12, "QueryName", "C:\Test\QueryExport.xlsx", True
Run-time error '3323':
The query can not be used as a row source
This is a simple select query, and I just want to write the result to Excel.