At a loss for how to proceed and would appreciate suggestions
Code: Select all
/*
Been researching 0x80040154 errors; common problems reported include:
1) COM classes not registered: I'm finding entries in registry (see screenshot)
Tried re-registering: "C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE" /regserver
2) Mismatch in 32 vs 64 bit: I don't think that's my problem:
Running AHK U64
Excel is 64-bit
TypeLib confirms 64-bit:
"TypeLib
{00020819-0000-0000-C000-000000000046}
1.9 [PrimaryInteropAssemblyName] = Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C
1.9 [<no name>] = Microsoft Excel 16.0 Object Library
0
Win64 = C:\Program Files\Microsoft Office\Root\Office16\EXCEL.EXE
Flags = 0
HelpDir = C:\Program Files\Microsoft Office\Root\Office16\"
3) Permissions: I don't think that's the problem either: I'm running as administrator and DCOM permissions for "Microsoft Excel Application" show full access rights
Ran several captures using PROCMON to compare ComObjCreate() on a COM class that works but that didn't help me figure out the problem.
At a loss for how to proceed and would appreciate suggestions
*/
x := Workbook()
/*
GUID: {00020819-0000-0000-C000-000000000046}
Implements: _Workbook; GUID: {000208DA-0000-0000-C000-000000000046}; Flags: IMPLTYPEFLAG_FDEFAULT
Implements: WorkbookEvents; GUID: {00024412-0000-0000-C000-000000000046}; Flags: IMPLTYPEFLAG_FDEFAULT, IMPLTYPEFLAG_FSOURCE
*/
Workbook()
{
try
{
If (impl:=ComObjCreate("{00020819-0000-0000-C000-000000000046}","{00024412-0000-0000-C000-000000000046}"))
return impl ; "(0x80040154) Class not registered"
throw "WorkbookEvents Interface failed to initialize."
}
catch e
MsgBox( e.Message )
}