using excel to change filenames

  • Thread starter Thread starter spence
  • Start date Start date
S

spence

i have several hundred files on my HD for a certain
program i use and i would like to change all of their
filenames, is it possible to import them into a
spreadsheet, manipulate the file names with some formulas
ans use the manipulated names to rename the files?
 
spence

It's fairly easy to do it in DOS, but it would mean doing it one directory
at a time. Is that any use?

Andy.
 
You could do this with a VBA macro. Assuming your data starts in row 1, with the path in column
A, the old name in B, and your new name in C:

Option Explicit

Sub RenameFiles()
Dim R As Long
Dim S As String
Dim TheData As Variant

S = Application.PathSeparator
TheData = Range("A1").CurrentRegion.Resize(ColumnSize:=3).Value

For R = 1 To UBound(TheData, 1)
Name TheData(R, 1) & S & TheData(R, 2) As _
TheData(R, 1) & S & TheData(R, 3)
Next R
End Sub
 
that would be fine can you tell me how
-----Original Message-----
spence

It's fairly easy to do it in DOS, but it would mean doing it one directory
at a time. Is that any use?

Andy.



.
 
Back
Top