【发布时间】:2017-09-09 15:31:30
【问题描述】:
我已成功使用 Access VBA 将查询导出到 .xlsx,并且我已使用 VBA 打开 .xlsx 文件,但现在我需要执行“另存为”以将文件转换为 .csv 或者,如果可能的话,.txt。这是一个包含数千个文件的大型自动化过程的一部分,所以我真的没有任何手动步骤。我需要从查询到 .txt 的过程在 Access VBA 中完全自动化。这是我当前的代码,它成功打开了我创建的文件:
Sub Export_Reduced_Inforce()
Dim Dest_Path, Dest_File As String
Dim xlApp As Object
Dest_Path = "C:\Inforce_Reduction\Result Files\"
Dest_File = "Test1"
DoCmd.TransferSpreadsheet acExport, 10, _
"0801_Reduce Inforce", Dest_Path & Dest_File, True
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.Workbooks.Open Dest_Path & Dest_File & ".XLSX", True, False
End Sub
【问题讨论】: