title: How to save .xlsx to .csv or .txt from Access VBA?
body: <p>I've successfully used Access VBA to export a query to .xlsx, and I have used VBA to open the .xlsx file, but now I need to do &quot;save as&quot; to convert the file to a .csv or, if possible, .txt. This is part of a large automated process with thousands of files, so I really can't have any manual steps. I need the process from query to .txt to be totally automated within Access VBA. Here is my current code, which successfully opens the file I've created:</p>
  <pre class="lang-vb prettyprint-override"><code>Sub Export_Reduced_Inforce()
  
      Dim Dest_Path, Dest_File As String
  
      Dim xlApp As Object
  
      Dest_Path = &quot;C:\Inforce_Reduction\Result Files\&quot;
      Dest_File = &quot;Test1&quot;
  
      DoCmd.TransferSpreadsheet acExport, 10, _
       &quot;0801_Reduce Inforce&quot;, Dest_Path &amp; Dest_File, True
  
      Set xlApp = CreateObject(&quot;Excel.Application&quot;)
  
      xlApp.Visible = True
      xlApp.Workbooks.Open Dest_Path &amp; Dest_File &amp; &quot;.XLSX&quot;, True, False
  
  End Sub
  </code></pre>