Other causes for "Error: 0x800401E3" for Microsoft Office?

Get help with using AutoHotkey and its commands and hotkeys
clina1j
Posts: 49
Joined: 22 Apr 2016, 18:39

Other causes for "Error: 0x800401E3" for Microsoft Office?

20 Jun 2017, 13:01

Greetings all,
I have been running an AutoHotKey Script on my company computer to control Excel successfully for the best part of a year. But, in the last few weeks, something has gone wrong. And now, every time I try to run the script, I get the "Error: 0x800401E3" message. It appears that AutoHotKey is no longer able to interact with excel. I looked up that error code on the forum.

I have tried the trick listed on this link:
https://autohotkey.com/board/topic/73940-excel-and-com/
Multiple windows did not help.

I have discussed the possible cause listed on this link with my IT help desk:
https://autohotkey.com/boards/viewtopic ... E3#p134879
My Helpdesk assures me that all programs would be running under my user ID and none would be Admin. He also tried deleting all sorts of temp files, but that did not help either.

Does anyone know of any other reasons for this error code? And the fixes for them that I can try?
Thanks to all for your help!
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: Other causes for "Error: 0x800401E3" for Microsoft Office?

20 Jun 2017, 19:12

Are you using ComObjActive? Try using Excel_Get instead.

This may explain (if this is the issue you are experiencing): https://autohotkey.com/board/topic/6424 ... /?p=405076
and the post it links to: https://support.microsoft.com/en-us/hel ... pplication

^^That is saying an error will occur if step 2 in the following sequence is skipped.
  1. Run Excel.
  2. Focus any other window (not Excel). (for an example see https://autohotkey.com/boards/viewtopic ... 779#p39779)
  3. Use ComObjActive("Excel.Application") <-- Error if step 2 was skipped.
Can you just use ComObjCreate instead of ComObjActive? That would avoid this error. Excel_Get, as suggested above, should also avoid this error. (Of course I am just guessing regarding the contents of your script.)

Code: Select all

#IfWinActive ahk_class XLMAIN

; Error if Excel was just launched and no other window has been focused yet.
F10::TrayTip,, % ComObjActive("Excel.Application").ActiveWorkbook.Name  ; Error:  0x800401E3 - Operation unavailable

; Works
F11::TrayTip,, % Excel_Get().ActiveWorkbook.Name

; Works
F12::
    xlApp := ComObjCreate("Excel.Application")
    xlApp.Visible := true
    wbk := xlApp.Workbooks.Open(A_ScriptDir "\Book1.xlsx")
    TrayTip,, % wbk.Name
return

#If

Esc::ExitApp

; Excel_Get - https://autohotkey.com/boards/viewtopic.php?f=6&t=31840
; <Paste the Excel_Get function definition here>
HTH :)
clina1j
Posts: 49
Joined: 22 Apr 2016, 18:39

Re: Other causes for "Error: 0x800401E3" for Microsoft Office?

21 Jun 2017, 12:31

You are right, I should have explained what code I was using, it is:

Code: Select all

[/oExcel := ComObjActive("Excel.Application") ; try to access active Workbook object
code]

It had been working for months until now.  Then, a few weeks ago, it stopped.  

I tried adding the code you listed to my existing script, and it works!  Specifically, "Excel_Get().ActiveWorkbook" WORKS!!  :dance:  :dance: 

I just added that line, and the "Excel_Get" code to my existing code, and it is now working fine!!  :superhappy:  :superhappy:  :superhappy:  :superhappy:  :dance: 

THANK YOU!!!

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], mikeyww, tatagi, teadrinker and 22 guests