I am trying to export a query to excel using transferspreadsheet. But it's giving me an error Run time error 3125 is not a valid name Make sure it does not include invalid characters and punctuation. I don't understand I am getting this error.
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, _
"Query9", "C:\Users\John\Desktop\Charts\Book1.xlsx", -1