C#, Office.Interop.Outlook.Application error 80040154

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RodneyAnonymous
    New Member
    • Oct 2007
    • 15

    C#, Office.Interop.Outlook.Application error 80040154

    I've got some code for composing an e-mail from the contents of an RTF box. The first time I execute it, everything works fine. If I close my app and then re-run it, however, I always receive the following error:

    Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040154.

    When reaching the line:
    Outlook.Applica tion outlookApp = new Microsoft.Offic e.Interop.Outlo ok.Application( );

    The only way I can solve this is to go into Add/Remove Programs and uninstall/reinstall the interop assemblies for Outlook. I have no idea what's causing this, because Microsoft's programmers apparently didn't see fit to include actual error descriptions that help you fix them.

    Can anyone help me with this issue?


    Code:
    Outlook.Applica tion outlookApp = new Microsoft.Offic e.Interop.Outlo ok.Application( );
    Outlook.MailIte m email = (Outlook.MailIt em)outlookApp.C reateItem(Micro soft.Office.Int erop.Outlook.Ol ItemType.olMail Item);
    email.Body = rtfReader.Rtf;
    email.BodyForma t = Microsoft.Offic e.Interop.Outlo ok.OlBodyFormat .olFormatRichTe xt;
    email.Display(f alse);
  • RodneyAnonymous
    New Member
    • Oct 2007
    • 15

    #2
    Update: At this point, I have tried several methods found across various regions of the intertron, including:

    -Marshal.Release ComObject(outlo okApp), outlookApp = null, and outlookApp.Quit in the Form_Closed/Form_Closing events and at the end of the function
    -email.Send(), rather than email.Display()

    So far none of these have worked.

    Comment

    • RodneyAnonymous
      New Member
      • Oct 2007
      • 15

      #3
      Does anyone have any idea about this?

      Comment

      Working...