Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi-
I have a folder with 500 or so Excel files and they all start with a specific date. For Example: 20070119_File1.xls Does anyone have a macro that will loop through the folder and rename just the date portion of the file? Example: I want to rename all of the files that start with 20070119 to start with 20061231 but still contain the rest of the filename. Take: 20070119_File1.xls and rename it: 20061231_File1.xls Any help is appreciated! Thanks, Chris |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could modify this to work within a DIR loop using mid oldname and mid
newname Sub movefile() OldName = "C:\oldfolderl\oldname.xls" NewName = "C:\newfolder\newname.xls" Name OldName As NewName End Sub Sub anotherfindfiles1() 'It does work. Application.ScreenUpdating = False Dim FN As String ' For File Name FileLocation = "c:\a\*.xls" FN = Dir(FileLocation) Do Until Left(FN, 3) = "Don" rename in here FN = Dir Loop Application.ScreenUpdating = True End Sub -- Don Guillett SalesAid Software wrote in message oups.com... Hi- I have a folder with 500 or so Excel files and they all start with a specific date. For Example: 20070119_File1.xls Does anyone have a macro that will loop through the folder and rename just the date portion of the file? Example: I want to rename all of the files that start with 20070119 to start with 20061231 but still contain the rest of the filename. Take: 20070119_File1.xls and rename it: 20061231_File1.xls Any help is appreciated! Thanks, Chris |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Don. Appreciate the help.
Chris Don Guillett wrote: You could modify this to work within a DIR loop using mid oldname and mid newname Sub movefile() OldName = "C:\oldfolderl\oldname.xls" NewName = "C:\newfolder\newname.xls" Name OldName As NewName End Sub Sub anotherfindfiles1() 'It does work. Application.ScreenUpdating = False Dim FN As String ' For File Name FileLocation = "c:\a\*.xls" FN = Dir(FileLocation) Do Until Left(FN, 3) = "Don" rename in here FN = Dir Loop Application.ScreenUpdating = True End Sub -- Don Guillett SalesAid Software wrote in message oups.com... Hi- I have a folder with 500 or so Excel files and they all start with a specific date. For Example: 20070119_File1.xls Does anyone have a macro that will loop through the folder and rename just the date portion of the file? Example: I want to rename all of the files that start with 20070119 to start with 20061231 but still contain the rest of the filename. Take: 20070119_File1.xls and rename it: 20061231_File1.xls Any help is appreciated! Thanks, Chris |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to create a copy of a folder having five files in it, & rename | Excel Worksheet Functions | |||
rename files in a folder | Excel Programming | |||
rename all files in a folder | Excel Programming | |||
Need Macro to rename excel files | Excel Programming | |||
rename folder o files with value from inside each wbk | Excel Programming |