I have a code which would copy a file from a location to another, make 2 copies of it and rename both.But when i try to rename, it is renaming the file at source folder. Pls suggest
Sub mycode()
Dim filesys, oFile, sName, oCount, dFile
'Set oCount = 0
Const sSourceFdr = "E:\VBS\"
Const sDestFdr = "E:\VBS\temp\"
Set filesys = CreateObject("Scripting.FileSystemObject")
For Each oFile In filesys.GetFolder(sSourceFdr).Files
On Error Resume Next
If InStr(1, oFile.Name, "Actuals") <> 0 Then
filesys.CopyFile oFile.Path, sDestFdr, OverWriteExisting
sName = Replace(oFile.Name, "Inter", "InterCA")
oFile.Name = sName
End If
Next
On Error GoTo 0
End Sub