Rename files with VBA
Hi,
Change the filenames and path to suit and try this
Sub DoSomething()
MyPath = "C:\"
MyFile = "Book2.xls"
NewName = "Othername.xls"
If Dir(MyPath & MyFile) < "" Then
Name MyPath & MyFile As MyPath & NewName
Else
MsgBox "File not found"
End If
End Sub
Mike
"michelle439731" wrote:
Afternoon,
I want to rename some files in a folder using vba.
Preferable what I would like to do is
a)find file x in folder a
b)rename file x to xy
Please can you help,
Cheers,
Michelle
|