Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim FSO As Object
Sub Folders() Dim i As Long Dim sFolder As String Set FSO = CreateObject("Scripting.FileSystemObject") SelectFiles "C:\test" End Sub '----------------------------------------------------------------------- Sub SelectFiles(Optional sPath As String) '----------------------------------------------------------------------- Dim fldr As Object Dim Folder As Object Dim file As Object Dim Files As Object Const LookFor As String = "Format for the" Const ChangeTo As String = "Current Time Sheet For" Set Folder = FSO.GetFolder(sPath) Set Files = Folder.Files For Each file In Files If file.Type Like "*Excel*" Then If Left$(file.Name, 14) = LookFor Then Name file.Path As Replace(file.Path, LookFor, ChangeTo) End If End If Next file For Each fldr In Folder.Subfolders SelectFiles fldr.Path Next End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Akash" wrote in message oups.com... 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Aug 16, 2:30 pm, "Bob Phillips" wrote:
Dim FSO As Object Sub Folders() Dim i As Long Dim sFolder As String Set FSO = CreateObject("Scripting.FileSystemObject") SelectFiles "C:\test" End Sub '----------------------------------------------------------------------- Sub SelectFiles(Optional sPath As String) '----------------------------------------------------------------------- Dim fldr As Object Dim Folder As Object Dim file As Object Dim Files As Object Const LookFor As String = "Format for the" Const ChangeTo As String = "Current Time Sheet For" Set Folder = FSO.GetFolder(sPath) Set Files = Folder.Files For Each file In Files If file.Type Like "*Excel*" Then If Left$(file.Name, 14) = LookFor Then Name file.Path As Replace(file.Path, LookFor, ChangeTo) End If End If Next file For Each fldr In Folder.Subfolders SelectFiles fldr.Path Next End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Akash" wrote in message oups.com... 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 Its not working.... |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Well that is a very illuminating response.
-- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Akash" wrote in message ups.com... On Aug 16, 2:30 pm, "Bob Phillips" wrote: Dim FSO As Object Sub Folders() Dim i As Long Dim sFolder As String Set FSO = CreateObject("Scripting.FileSystemObject") SelectFiles "C:\test" End Sub '----------------------------------------------------------------------- Sub SelectFiles(Optional sPath As String) '----------------------------------------------------------------------- Dim fldr As Object Dim Folder As Object Dim file As Object Dim Files As Object Const LookFor As String = "Format for the" Const ChangeTo As String = "Current Time Sheet For" Set Folder = FSO.GetFolder(sPath) Set Files = Folder.Files For Each file In Files If file.Type Like "*Excel*" Then If Left$(file.Name, 14) = LookFor Then Name file.Path As Replace(file.Path, LookFor, ChangeTo) End If End If Next file For Each fldr In Folder.Subfolders SelectFiles fldr.Path Next End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Akash" wrote in message oups.com... 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 Its not working.... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
update the hyperlink in file after changing the file name | Excel Worksheet Functions | |||
delete info from source file w/out changing the destination file | New Users to Excel | |||
Save as new file without changing existing file | Excel Programming | |||
Open Test file with VBA with a changing file number | Excel Programming | |||
Open delimited text file to excel without changing data in that file | Excel Programming |