Reputation: 504
I am using DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "qryExportData", strExportPath, True
to export an Access 2013 query to Excel with the save name/location hardcoded in the variable strExportPath
Is it possible to have Access VBA always over-write the file if it currently exists, or do I need to run a seperate VBA syntax to first check if the file exists, if it does delete, then save as?
Upvotes: 0
Views: 928
Reputation: 346
I think this might get you what you want. I didn't test it for your specific circumstance but... should work.
Application.DisplayAlerts = False
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "qryExportData", strExportPath, True
Application.DisplayAlerts = True
Upvotes: 4