Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Anyone have a method for looping through a folder and renaming a file based on
a criteria. I don't necessarily need the dir loop. But how do you rename something, much less based on a criteria? Use a .filesearch object For example, say I have things called October Report.doc, October Sales.xls. October Song.mp3 I don't want to open them just rename the files from Oct to Nov Report.doc, October Sales.xls, etc I just want to replace part of the name based on a search criteria. Possible? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
loop through the dirrectory..
Dim FN as string, MyPath As String MyPath = "C:\Temp\FolderX\" FN = DIR(MyPath & "*.*") DO UNTIL FN="" If FN LIKE ("Nov*.*) Then Rename MyPath & FN, MyPath & "Dec " & Mid(FN,4) End If FN = DIR LOOP Patrick Molloy Microsoft Excel MVP -----Original Message----- Anyone have a method for looping through a folder and renaming a file based on a criteria. I don't necessarily need the dir loop. But how do you rename something, much less based on a criteria? Use a .filesearch object For example, say I have things called October Report.doc, October Sales.xls. October Song.mp3 I don't want to open them just rename the files from Oct to Nov Report.doc, October Sales.xls, etc I just want to replace part of the name based on a search criteria. Possible? . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Renaming excel files in a folder | Excel Discussion (Misc queries) | |||
Excel Renaming Files When Opening Using File Convertor | Excel Discussion (Misc queries) | |||
Renaming Files w/Excel | Excel Discussion (Misc queries) | |||
Batch renaming of many worksheets in Excel files? | Excel Discussion (Misc queries) | |||
Renaming Files | Excel Discussion (Misc queries) |