Renaming files using an Excel spreadsheet

  • Thread starter Thread starter Rich
  • Start date Start date
R

Rich

Is there a way to do automate the renaming of a large number of files from a
spreadsheet that contains the old and new data?

Thanks!

-Rich
 
Hi Rich,
actually this is an access programming discussion group and your question is
about excel and so is better if you post it in the excel discussion but here
is the answer to your question. Try this

Set fs = CreateObject("Scripting.FileSystemObject")
fs.movefile Cells(rowindexoldname, columnindexoldname),
Cells(rowindexnewname, columnindexnewname)

you can put the movefile instruction in a loop increasing the rowindex to
read all the rows in your spreadsheet with the file to be renamed.
The cells must contain the full path and the name of the file
If a file with the newname already exist an erro is raised

HTH Paolo
 
Paolo,

Thanks - I'll try to figure it out based on your info. I'm fairly new to
this and may have to ping on you a few times. Would that be ok?

Thanks,
-Rich
 
Yeah, feel free to post your questions.
But you wanna do the renaming trick from access or from excel?
I'm asking that 'cause the answer I gave you works if you use it in the
visual basic for excel. If you wanna do it from access is a little bit
different.

Cheers
 
From Excel - Thanks!

Paolo said:
Yeah, feel free to post your questions.
But you wanna do the renaming trick from access or from excel?
I'm asking that 'cause the answer I gave you works if you use it in the
visual basic for excel. If you wanna do it from access is a little bit
different.

Cheers
 
Back
Top