Here is a sub that will rename a file. In this case it is actually moving it
on your HD.
Sub movefile()
OldName = "C:\personal\1065.xls"
NewName = "C:\a\1065.xls"
Name OldName As NewName
End Sub
So, this should do what you want. Change Myfolder to suit. Test as is then
change the ' comment lines
Sub RenameFiles()
Application.ScreenUpdating = False
Dim FN As String ' For File Name
Dim MyFolder As String
MyFolder = "c:\a\*.xls"
FN = Dir(MyFolder)
Do Until FN = ""
If FN < "PERSONAL.XLS" Then
MsgBox """" & Left(MyFolder, Len(MyFolder) - 5) & FN & """"
'oldname="""" & Left(MyFolder, Len(MyFolder) - 5) & FN & """"
MsgBox """" & Left(MyFolder, Len(MyFolder) - 5) & Left(FN, 12) & ".xls"""
'newname="""" & Left(MyFolder, Len(MyFolder) - 5) & left(fn,12) & ".xls"""
'Name OldName As NewName
End If
FN = Dir
Loop
Application.ScreenUpdating = True
End Sub
--
Don Guillett
SalesAid Software
"fitful_thought" wrote in message
...
Hi,
Is it possible to rename all the files in a folder with the first twelve
characters of the existing filename?
Ta,
DL