EDIT:
I figured it out. ComObjGet was causing the issue. I didn't realize I needed to change the variable for it to work. Sorry guys!
Code: Select all
Path := "C:\Users\" . A_Username . "\Desktop\Book1.xlsx"
XL := ComObjCreate("Excel.Application")
XL.Workbooks.Open(Path)
XL.Visible := False
XL2 := ComObjGet(Path)
Return
1::
If ( XL.Visible = False )
XL.Visible := True
Else
XL.Visible := False
Return