View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Changing File Name

Here is the code. Change MyPath to match your filesystem

Sub renamefile()
Dim fs, f, f1, fc, s

Const MyPath = "c:\temp\August 07"
Const OldfileName = "Format for the 1st Aug to 10 Aug"
Const NewfileName = "Current Time Sheet For 1st Aug to 10th Aug"

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(MyPath)
Set employees = f.SubFolders
For Each employee In employees

Set f1 = fs. _
getfile(employee & "\" & OldfileName)
f1.Name = NewfileName
Next
MsgBox s
End Sub


"Akash" wrote:

Hi,

Suppose i have a Folder August 07
Inside there are 50 folders of Different Employees
Under Each folder i have one Excel File with the name of "Format for
the 1st Aug to 10 Aug"

Now what i want is to change the name of the File from "Format for the
1st Aug to 10 Aug" to "Current Time Sheet For 1st Aug to 10th Aug"

How can i do that....

Thanks

Regards
Akash