title: How to export multiple worksheets to CSV (without saving over the current worksheet)
body: <p>I'm trying to export a number of worksheets in my workbook to .csv via some code like this:</p>
  
  <pre><code>Sub Export_To_CSV(exportPath As String)    
  
      Dim filePath As String 
  
      For Each WS In ThisWorkbook.Worksheets
  
              filePath = exportPath &amp; "(" &amp; WS.Name &amp; ").dat"
              WS.SaveAs Filename:=filePath, FileFormat:=xlCSV
  
      Next 
  End Sub
  </code></pre>
  
  <p>The problem is that this saves over the current .xlsm file that I have open. </p>
  
  <p>How can I get it to export the .csv without changing the name of the current file?</p>
  
  <p>I thought <code>SaveCopyAs</code> would do the trick,  but it only applies to a <code>workbook</code> and not a <code>worksheet</code>.</p>