title: Running a Macro over multiple excel files and saving them in a new directory
body: <p>I know a very similar form of this question has been asked many times before, but I'm having some problems getting it to work with my macro.</p>
  
  <p>Basically, what I need is to have a Macro that will run over several hundred files all located in the same folder, and then "save" the new files (<strong>without replacing the old files</strong>) in a separate folder/directory. Obviously without having to open each file individually and running the Macro over and over again.</p>
  
  <p>I've tried a few different suggestions but they have all either resulted in drastically unnecessary changes to my fully functioning macro, or have ended in substantial errors.</p>
  
  <p>The location of the original files is--> F:\Reports_Complete\Reports_201308_2014\<br>
  . . . The folder only contains files that the Macro needs to run on, and they are all .csv files (the final files should be .xls). . .</p>
  
  <p>The location of the files after the Macro runs should be--> F:\Reports_Complete\</p>
  
  <p>As opposed to copying the entirety of my several hundred line Macro, here are the important lines:</p>
  
  <p>In the beginning of the Macro:</p>
  
  <pre><code>ActiveWorkbook.SaveAs Filename:="F:\Reports_Complete\EXT872_VTDT_" &amp; Range("B2").Text &amp; ".xls"
  </code></pre>
  
  <p>........................</p>
  
  <p>At the end of the Macro:</p>
  
  <pre><code>With ActiveWorkbook
  'MsgBox .FileFormat, , .FullName
  Application.DisplayAlerts = False
  .SaveAs .FullName, xlNormal
  Application.DisplayAlerts = True
  'MsgBox .FileFormat, , .FullName
  End With
  </code></pre>
  
  <p>I would be extremely grateful for some help, and if possible without jumping over any steps or procedures ;-)</p>
  
  <p>Thanks again!!!</p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>Sub ProcessFiles()
  Dim Filename, Pathname As String
  Dim wb As Workbook
  
  Pathname = ActiveWorkbook.Path &amp; "\Files\"
  Filename = Dir(Pathname &amp; "*.csv")
  Do While Filename &lt;&gt; ""
      Set wb = Workbooks.Open(Pathname &amp; Filename)
      DoWork wb
      wb.Close SaveChanges:=True
      Filename = Dir()
  Loop
  End Sub
  </code></pre>
  
  <p>..........</p>
  
  <pre><code>Sub DoWork(wb As Workbook)
  With wb
  'Here is where my code is
  End With
  End Sub
  </code></pre>
  
  <p>I've tried using the above code, but it isn't working for me. Is there another way to make my macro work across an entire folder?</p>