Opening Office Application Error: Microsoft.Office.Interop.Excel / Microsoft.Office.Interop.Word

0

I am hoping that someone can give a little insight and/or instance.

I am experiencing an error trying to create an instance of an Excel or Word application. The application I am working on is using interop assemblies to manipulate Excel and Word. In both cases, I have been successful in doing so in the past, the problems/errors began only recently. I've noticed multiple posts about similar error messages and have looked through them, but none addressed a similar issue or provided relevant insights.

In attempting to create an instance of Excel, the resulting error is similar to the following:

{System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)). at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType) at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType) at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj) at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type)

I am encountering a similar error when trying to create an instance of Word. Again, my code has been doing this with no problem, until recently.

I'm thinking this may have started with possibly with recent upgrades to the Office instance on my development machine.

The references for both Interop assemblies (Microsoft.Office.Interop.Excel and Microsoft.Office.Interop.Word) associated with my project have Embed Interop Types set to TRUE)

If I am interpreting the error text correctly, the code is looking for the typelib/class id (i.e., {00024500-0000-0000-C000-000000000046}) to be in the current machine's registry and cannot find it. I did search the \HKEY_CLASSES_ROOT\TypeLib folder in the registry and did not see it. My question would be, why is it looking for that particular id? Of course, I may be completely out in left field on this line of reasoning.

Since I am seeing similar effects in both contexts, I have to believe that the issue's cause here is on the Office level, rather than either application. To the best of my knowledge, no change was made to the code or the Interop assembly references in the project.

Any insights and/or suggestions would, of course, be greatly appreciated.

I am using VS 2017 (64-bit) on Windows 10.

excel
vb.net
ms-word
interop
office-interop
asked on Stack Overflow Apr 13, 2020 by Christopher H. Fleetwood • edited Apr 15, 2020 by Cindy Meister

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0