Hi all,
I’m trying to write a script that will open an excel spreadsheet, update a cell, save the spreadsheet and then close it.
I get the following error when I run the script:
Wrong number of arguments or invalid property assignment: ‘objExcel.ActiveWorkbook.Save’
Line 8, Code: 800A01C2
I have noticed that it has opened Excel but there are 2 spreadsheets running: test.xls and book1
Here is the code I have:
————————————-
Set objExcel = CreateObject(“Excel.Application”)
Set objWorkbook = objExcel.Workbooks.Open(“C:\test.xls”)
objExcel.Application.Visible = True
objExcel.Workbooks.Add
objExcel.Cells(1, 1).Value = “Test value”
objExcel.ActiveWorkbook.Save “C:\test.xls”
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
WScript.Echo “Finished.”
WScript.Quit
————————————-
Any assistance would be greatly appreciated thank you.
Regards,
Aaron.