By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,490 Members | 1,398 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,490 IT Pros & Developers. It's quick & easy.

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

P: 15
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.Application outlookApp = new Microsoft.Office.Interop.Outlook.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.Application outlookApp = new Microsoft.Office.Interop.Outlook.Application();
Outlook.MailItem email = (Outlook.MailItem)outlookApp.CreateItem(Microsoft. Office.Interop.Outlook.OlItemType.olMailItem);
email.Body = rtfReader.Rtf;
email.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFo rmatRichText;
email.Display(false);
Nov 1 '07 #1
Share this Question
Share on Google+
2 Replies


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

-Marshal.ReleaseComObject(outlookApp), 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.
Nov 1 '07 #2

P: 15
Does anyone have any idea about this?
Nov 6 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.