Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Rename Multiple File Names in Windows XP Professional 5.1

I have approx 1,000 files in which the file name begins with BPM[space]unique
name.####. I would like to change all of the files to read BPM[dash].unique
name.#### without renaming each file individually. Is this possible?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Rename Multiple File Names in Windows XP Professional 5.1

Works with Excel 2003 and earlier - if you have Excel 2007, you need to use DIR instead of
FileSearch. Change the folder to your path, or uncomment the Thisworkbook.Path line and store the
file with the macro in the same folder as your BPM files.....

Sub RenameFiles()
Dim oldName As String
Dim newName As String
With Application.FileSearch
.NewSearch
.LookIn = "C:\Folder Name"
'.LookIn = ThisWorkbook.Path
.FileType = msoFileTypeAllFiles
.SearchSubFolders = True ' Careful with this option...
If .Execute 0 Then
For i = 1 To .FoundFiles.Count
If .FoundFiles(i) Like "*\BPM *" Then
newName = Replace(.FoundFiles(i), "\BPM ", "\BPM-")
oldName = .FoundFiles(i)
Name oldName As newName
End If
Next i
End If
End With
End Sub


HTH,
Bernie
MS Excel MVP


"Chilired" wrote in message
...
I have approx 1,000 files in which the file name begins with BPM[space]unique
name.####. I would like to change all of the files to read BPM[dash].unique
name.#### without renaming each file individually. Is this possible?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple windows of single file display on windows taskbar easylife Excel Programming 2 June 3rd 09 03:29 PM
Most times I run Microsoft Excel 2003 Professional, Windows Installerruns first [email protected] Excel Discussion (Misc queries) 2 December 11th 07 07:41 AM
windows is configuring my microsoft office xp professional overinjapan(remove)@yahoo.com Excel Discussion (Misc queries) 0 February 28th 06 10:49 AM
Excel 2003 using Windows XP Professional Nigel New Users to Excel 1 August 5th 05 02:22 AM
Rename Multiple Sheets from a List of Available Names prkhan56 Excel Programming 5 April 4th 05 06:07 PM


All times are GMT +1. The time now is 03:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"