Jump to content

Excel fails to launch


Recommended Posts

I have been using some AutoIt scripts to manipulate Excel for a few weeks now. Today they stopped working. I have rebooted the PC and I'm not aware of any other significant changes. I can start and use Excel conventionally without a problem, but any attempt to create an excel object from AutoIt fails. E.g

#include <MsgBoxConstants.au3>
#include <Excel.au3>
Local $oExcel = _Excel_Open()
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Open Example 1", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

Produces:

@error = 1

@extended = -2147221005

I can't find that COM error listed anywhere... Anyone have any ideas?

Problem solving step 1: Write a simple, self-contained, running, replicator of your problem.

Link to comment
Share on other sites

-2147221005 is 0x800401F3 and stands for "Invalid Class String".
This happens when is being run as Administrator or System user and Excel is just available for the logged on user.

Do you run the script compiled or from SciTE by pressing F5?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Ah, sorry I should have thought about the hex.... It is starting to make sense now, last week the IT team made some changes to my login, although I have always had Admin privs on this PC I wonder if it is related to that. I'll do some more digging.

Problem solving step 1: Write a simple, self-contained, running, replicator of your problem.

Link to comment
Share on other sites

I believe the problem is that my domain user name has gained my initial at the front of it, but my office 365 user name is the old one without the initial (even though I log into 365 with the initial added, it does not show in the 365 user of excel). Apparently my UID has not changed anywhere so everything should be fine, but it seems this is not the case.

I have no influence at the domain/365 level, so I'm basically locked out of AutoIt on excel... super irritating.

Problem solving step 1: Write a simple, self-contained, running, replicator of your problem.

Link to comment
Share on other sites

Did you try using run("[insert excel path here]\EXCEL.EXE") ?

run("[insert excel path here]\EXCEL.EXE")
$oExcel = _Excel_Open()

;Do stuff

_Excel_Close($oExcel,True,True) ;set the forceClose (last argument) to True to Close the excel even if it wasn't opened by _Excel_Open

It's just an Idea...

Link to comment
Share on other sites

Unfortunately, the problem appears to be with the COM object. For example, even trying to use

Local $oExcel = ObjGet("", "Excel.Application")

to grab an already open instance of Excel fails with the same problem.

Sorry Water, to answer your question, the problem occurs with both the compiled and un-compiled code. I've also tried #RequireAdmin to no avail.

Edited by SlackerAl

Problem solving step 1: Write a simple, self-contained, running, replicator of your problem.

Link to comment
Share on other sites

Update:

Well, after some random thrashing at the keyboard I see office 365 now has the same user name as my domain name showing, But I still have the same error message when trying to start Excel from AutoIt. So perhaps that was a coincidence.

Problem solving step 1: Write a simple, self-contained, running, replicator of your problem.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...