I have some VBscript that should go out to a specific folder, open all .xlsm files within that folder, refresh all, save and close the files. This script is kicked off by windows task scheduler each morning at 4 a.m.
Currently, this script opens the first .xlsm file listed, refreshes, but does not save, then closes. no other files in the folder are opened.
This is the code i currently have:
Set fso = CreateObject("Scripting.FileSystemObject")
Set xl = CreateObject("Excel.Application")
xl.Visible = True
For Each f In fso.GetFolder("[file path to folder i want files updated]").Files
If LCase(fso.GetExtensionName(f.Name)) = "xlsm" Then
Set wb = xl.Workbooks.Open(f.Path)
wb.RefreshAll
WScript.Sleep 5*60*1000
wb.Save
wb.Close
End If
Next
xl.Quit
Thank you for any suggestions.