Solved

.NET MS Interop Word - COM Class Factory Error

Posted on 2014-03-24
5
5,029 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
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…

809 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