T
TISR
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.
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.