Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

.NET MS Interop Word - COM Class Factory Error

Posted on 2014-03-24
5
5,064 Views
Last Modified: 2014-03-29
I am developing a .NET 2012 application and using Microsoft.Interop.Word.  When my code gets to the sample code below it breaks in the Initialize method:

public class eobPrintBatch
{
    private Microsoft.Office.Interop.Word.Application wApp;

    private void Initialize()
    {
        wApp = new Microsoft.Office.Interop.Word.Application();  //Breaks here
    }
}

Open in new window


The error I am receiving is:

{"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005."}
    [System.Runtime.InteropServices.COMException]: {"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005."}
    Data: {System.Collections.ListDictionaryInternal}
    HelpLink: null
    InnerException: null
    Message: "Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005."
    Source: "PrintApp"
    StackTrace: "   at Print.PrintBatch.Initialize() in c:\\Apps\\PrintApp2012\\PrintBatch.cs:line 277\r\n   at PrintApp.PrintBatch.DoMonitor() in c:\\Apps\\PrintApp2012\\PrintBatch.cs:line 86"
    TargetSite: {Void Initialize()}

Open in new window


Any ideas?
0
Comment
Question by:CipherIS
  • 4
5 Comments
 
LVL 20

Expert Comment

by:Daniel Van Der Werken
ID: 39951007
Are you using the Microsoft Primary Interop Assemblies?

Basic info on PIA's:
http://msdn.microsoft.com/en-us/library/aax7sdch(v=vs.110).aspx

More information on Office PIA's:
http://msdn.microsoft.com/en-us/library/15s06t57.aspx

My best guess on this is that the .NET application is trying to load the appropriate Office COM object and unable to find it. You need to make sure you have the correct PIA's installed and properly "configured" to work with the correct version of Office on that system.
0
 
LVL 1

Author Comment

by:CipherIS
ID: 39951120
I removed the Interop and re-added it.  Now I'm receiving

{"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))."}
    [System.Runtime.InteropServices.COMException]: {"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))."}
    Data: {System.Collections.ListDictionaryInternal}
    HelpLink: null
    HResult: -2146959355
    InnerException: null
    Message: "Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))."
    Source: "mscorlib"

Open in new window

0
 
LVL 1

Author Comment

by:CipherIS
ID: 39951126
Now its back to its original error:

{"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005."}
    [System.Runtime.InteropServices.COMException]: {"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005."}
    Data: {System.Collections.ListDictionaryInternal}
    HelpLink: null
    InnerException: null
    Message: "Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005."
0
 
LVL 1

Accepted Solution

by:
CipherIS earned 0 total points
ID: 39951403
I figured out the issue.  Office was corrupted.  I reinstalled Office and it resolved the issue.

Thank You
0
 
LVL 1

Author Closing Comment

by:CipherIS
ID: 39963531
Had to reinstall office.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question