Solved

.NET MS Interop Word - COM Class Factory Error

Posted on 2014-03-24
5
4,908 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 19

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

It is often necessary in this forum and others to illustrate Word fields as text with the field delimiters replaced with the curly brackets that the delimiters resemble when field codes are being displayed on the document. This means that the text c…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now