Rename documents driven by excel

WildAngus

New Member
Joined
Jan 10, 2007
Messages
28
Here's something I've always thought should be possible but never been able to do.....

Is there a way of renaming a set of sequentially named files into another sequentially named format using excel or VBA or a combination?

My example is a batch of photograps names as, DSC0001, DSC0002, DSC0003, etc
and I want to rename these as: 2009-12-01-001, 2009-12-01-002, 2009-12-01-003, etc

so my idea is to use col A for the old value and col C for the new value and open document as shown in col A and save it as the value in col B, moving down the list.

Is this feasible? or is there an even easier way?

Any help would be welcome.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Just about to go home for the eve, but you should be able to adapt this to meet your requirements pretty easily. Test it on a small folder first

Code:
Sub ReNameFiles1()
Dim path As String, filespec As String
Dim CurrentName As String, NewName As String
path = "I:\Claims\Lees Folder (Do not remove)\NorthernSoulCD001\" ' your path
For i = 1 To 14605 ' your range 
Range("C1").Value = Range("A" & i).Value
Range("D1").Value = Range("B" & i).Value
CurrentName = Range("C1").Value
NewName = Range("D1").Value
Name path & CurrentName As path & NewName
Next i
End Sub

Lee
 
Last edited:
Upvote 0
I love this solution!!

Want to add a note here that the file name (The one you about to change)
must contain its suffix. myfile.xls etc'

Thanks
Amit
 
Upvote 0

Forum statistics

Threads
1,215,884
Messages
6,127,560
Members
449,385
Latest member
KMGLarson

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top