Hi
I am very new to this. I am using the code below to save workbooks with date as part of the filename. It is working correctly but I want to save the files in a sub folder not the original. The original location is ("C:\Users\xxxxxxxxxxxxxx\Trial") but I want to save them in ("C:\Users\xxxxxxxxxxxxxx\Trial\TEST"). I have tried to find the answer but nothing seems to work. Thanks for any help.
Malcolm
Set app = CreateObject("Excel.Application")
app.Visible = False
app.DisplayAlerts = False
Set fso = CreateObject("Scripting.FileSystemObject")
For Each f In fso.GetFolder("C:\Users\xxxxxxxxxxxxxx\Trial").Files
If LCase(fso.GetExtensionName(f)) = "xlsx" Then
Set wb = app.Workbooks.Open(f.Path)
filename = f
newname = fso.BuildPath(wb.path, fso.GetBaseName(wb.Name) & Year(Date) & Right("1" & Month(Date),2) & Right("1" & (Date),2) & ".xls")
wb.SaveAs newname, -4143
wb.Close SaveChanges=True
End if
Next
app.Quit
Set app = Nothing
Set fso = Nothing
Bookmarks