我使用DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "qryExportData", strExportPath, True
将Access 2013查询导出到Excel,并在变量strExportPath
是否可以让Access VBA总是覆盖文件(如果它当前存在),或者我是否需要运行单独的VBA语法来首先检查文件是否存在,如果文件是否删除,则保存为?
答案 0 :(得分:4)
我认为这可能会让你得到你想要的东西。我没有根据你的具体情况对它进行测试,但......应该有效。
Application.DisplayAlerts = False
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "qryExportData", strExportPath, True
Application.DisplayAlerts = True