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.
 

the_original_invisible

Board Regular
Joined
May 27, 2004
Messages
199
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:

amitcohen

Board Regular
Joined
Jan 14, 2010
Messages
118
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
 

Forum statistics

Threads
1,082,269
Messages
5,364,148
Members
400,783
Latest member
sambills

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top