Mass File Rename using Excel VBA


Ever needed to rename hundreds of Excel workbooks in a folder? Use this VBA code to do it.

Sub sbFileRename()
  sPath = "C:\Stuff\"
  sFilename = Dir(sPath & "*v2.0*.txt")
  Do While sFilename <> ""
   sNewFilename = Replace(sFilename, "v2.0", "v3.0")
   Name sPath & sFilename As sPath & sNewFilename
   sFilename = Dir()
  Loop
End Sub