Mass change of .xls file names?

  • Thread starter Thread starter kaleb0521
  • Start date Start date
?

If you have some logic, you can use a macro to loop through all the files
and rename using the DOS Name command: see an example below.

HTH,
Bernie
MS Excel MVP

Sub RenameFiles()
Dim oldName As String
Dim newName As String
With Application.FileSearch
.NewSearch
.LookIn = "C:\Excel"
.FileType = msoFileTypeExcelWorkbooks
.SearchSubFolders = False
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
If .FoundFiles(i) Like "*\Book*" Then
newName = Replace(.FoundFiles(i), "\Book", "\Buuk")
oldName = .FoundFiles(i)
Name oldName As newName
End If
Next i
End If
End With
End Sub
 
Back
Top