ComObjActive is not working as expected...

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Relayer
Posts: 160
Joined: 30 Sep 2013, 13:09
Location: Delaware, USA

Re: ComObjActive is not working as expected...

06 Dec 2016, 10:14

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
hastegag3

Re: ComObjActive is not working as expected...

27 Dec 2017, 16:49

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!
jekko1976
Posts: 97
Joined: 10 Oct 2014, 07:03

Re: ComObjActive is not working as expected...

05 May 2018, 14:22

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

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
	}
}
hope it helps...

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 241 guests