VBScript: Open and Process Excel Files in a Folder and Save in another Folder

In cmd, run “cscript test.vbs” under the folder where test.vbs is saved.

Contents of test.vbs

Set objFSO = CreateObject("Scripting.FileSystemObject")
sFolder = "X:\Work\test1\"
oFolder = "X:\Work\test1\result\"
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.DisplayAlerts = False
For Each objFile In objFSO.GetFolder(sFolder).Files
Set objWorkbook = objExcel.Workbooks.Open(sFolder & objFile.Name)
objWorkbook.sheets("delete").Select
objWorkbook.sheets("delete").Delete
objWorkbook.SaveAs oFolder & objFile.Name
objWorkbook.Close
objExcel.Quit
Set objWorkbook = Nothing
Next
Set objFSO = Nothing
Set objExcel = Nothing;