LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Change name of files in a folder

Hi to all
I am able to copy files into a folder using Scripting.FileSystemObject.
Once in the new folder I would like to change their name to reflect the new
month.
I have tried:
Const Dest = "C:\Mis documentos\12 December 2005"
Dim FSO As Object
Dim f, f1, fc
Set f = FSO.GetFolder(Dest)

For Each f1 In f.Files
Name f1.Path As Mid(f1.Name, 1, (Len(f1.Name) - 9)) & _
Format(DateSerial(Year(Date), Month(Date) - 1, 1), "yyyy-mm")
Next f1
And I have also tried
Dim wkbFolder As Application
Dim wkbSource As Workbook
Set wkbFolder.Path = "C:\Mis documentos\12 December 2005"
Set wkbSource = Application.ActiveWorkbook
For Each wkbSource In wkbFolder.Path
wkbSource.Name = Mid(wkbSource.Name, 1, (Len(wkbSource.Name) - 9)) & _
Format(DateSerial(Year(Date), Month(Date) - 1, 1), "yyyy-mm")
Next
Needless they don“t work
Can someone help? It would be appreciated.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pulling pdf files from general folder to specific folder [email protected] Excel Discussion (Misc queries) 2 September 8th 09 09:41 PM
Change names of Files in a folder TISR Excel Programming 1 April 1st 06 10:40 AM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 03:28 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven[_2_] Excel Programming 1 January 24th 06 04:23 AM
Change names of files in a folder to match names in Excel Column saybut Excel Programming 4 February 9th 04 06:26 PM


All times are GMT +1. The time now is 12:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"