Excel Fox
08-30-2011, 08:29 PM
For renaming files in a folder in series, use the following code
Sub Renamer()
Const strPath As String = "C:\Path Of Folder\"
Dim strFile As String
Dim lngLoop As Long
lngLoop = 1
strFile = Dir(strPath)
Do While strFile <> ""
Name strPath & strFile As strPath & "ANYPREFIX" & Format(lngLoop, "0000") & Right(strFile, Len(strFile) - InStrRev(strFile, ".") + 1)
lngLoop = lngLoop + 1
strFile = Dir
Loop
End Sub</SPAN></SPAN>
Sub Renamer()
Const strPath As String = "C:\Path Of Folder\"
Dim strFile As String
Dim lngLoop As Long
lngLoop = 1
strFile = Dir(strPath)
Do While strFile <> ""
Name strPath & strFile As strPath & "ANYPREFIX" & Format(lngLoop, "0000") & Right(strFile, Len(strFile) - InStrRev(strFile, ".") + 1)
lngLoop = lngLoop + 1
strFile = Dir
Loop
End Sub</SPAN></SPAN>