I use the com interface of Excel extensively using AHK. I recently had the need to duplicate a computer with all the same functionality that I have on my main machine. I specifically selected a machine that best matches the original machine with some small differences: windows 7 professional vs. windows 7 enterprise. Both use office 2010. I wanted a close match to avoid heartache getting the thing up and running.
I did a fresh install of office 2010 and started Excel only to get "0c800401E3 Operation Unavailable" when my AHK script ran using ComObjActive("Excel.Application"). The error has been discussed in several AHK forum threads and there is some information on line about it... but what gets me is how squirrelly the windows environment can be. It has worked flawlessly on my main machine for years even with many instances of Excel running and switching between them for an entire work day. It seems that not even Microsoft understands the root cause or cares to fix it. So it's down to "try this, try that" and maybe you'll find a workaround. One suggestion was around giving focus to some other application and then run the script but I found that doesn't play well with multiple instances of Excel running simultaneously. Trouble is, that makes this application instance "special" assuming I find a reasonable approach not to mention the embarrassment of colleagues saying, "I thought you had this working!!!"
Please excuse my complaining. Maybe I expect too much.
Relayer
"When all else fails, lower your expectations." -wise friend
ComObjActive is not working as expected...
Re: ComObjActive is not working as expected...
Had this issue also with win 10 x 64 and office 2016 but for me i noticed it was because i had been running the script as administrator which does not allow the comobjectactive. YMMV, but try running not as admin and it may help!
Re: ComObjActive is not working as expected...
Howdy,
i just had the same problem and the solution to switch to another window then switch back to Excel for me worked fine.
I put some code here for your convenience
hope it helps...
i just had the same problem and the solution to switch to another window then switch back to Excel for me worked fine.
I put some code here for your convenience
Code: Select all
SetTitleMatchMode, 2
OpenWindow("Excel")
OpenWindow("[AnotherWindow]")
OpenWindow("Excel")
oExcel:=ComObjActive("Excel.Application")
;-------------OPEN AN EXISTING WINDOW
OpenWindow(nome)
{
WinWait, %nome%
IfWinExist, %nome%
{
WinActivate, %nome%
WinWaitActive, %nome%
WinShow, %nome%
Sleep, 500
}
}
Who is online
Users browsing this forum: Google [Bot] and 194 guests