Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
The existing filenames are too long.
Hi,
Is it possible to rename all the files in a folder with the first twelve characters of the existing filename? Ta, DL |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
The existing filenames are too long.
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo | Excel Discussion (Misc queries) | |||
Long Long Long Nested If Function | Excel Discussion (Misc queries) | |||
can not scroll on Edit links very long list of filenames | Excel Discussion (Misc queries) | |||
Clearing cells takes long, long time | Excel Discussion (Misc queries) | |||
download existing spreadsheets into another existing spreadsheet | Excel Discussion (Misc queries) |