I'm trying to create an ahk script to save and close all excel files I have open, however I'm struggling.
I've tried this but get errors on two lines (see below):
Excel := ComObjActive("Excel.Application")
loop % Excel.workbooks.count ;i get an error on this line
if fileexist(Excel.workbooks(a_index).fullname)
Excel.Workbooks(a_index).save
excel.quit() ;i get an error on this line
And I've tried this, but again I get errors:
xl := ComObjActive("Excel.Application")
for wrkbk in xl.workbooks ;i get an error on this line
wrkbk.close(1)
xl.quit() ;i get an error on this line
Can anyone help? Thanks in advance.