473,408 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

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.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
2 10681
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
Does anyone have any idea about this?
Nov 6 '07 #3

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

Similar topics

0
by: Patrick Jox | last post by:
Hello, I created a .NET COM Add-In which exposes a new Menu with two MenuItems. The one to create a calendaritem and the other one to display the first contact in the default contactsfolder. What...
1
by: Stephen Noronha | last post by:
Hi, I am trying a sample app to send an email from my app I am getting a "type not defined error" I have added "Office and Outlook" COM component but still I am getting this error... Please...
2
by: Miguel Arenas | last post by:
I want to develop a aplication with VB.2003 and Microsoft outlook 2003. I have this code. Imports OutLook = Microsoft.Office.Interop.Outlook Imports System.Reflection Private Sub...
0
by: Tim | last post by:
I have a .net application using the outlook interface to create and maintain outlook calendar items. It's a free standing application, not integrated into outlook. When Outlook is configured for...
7
by: Markus Donath | last post by:
I want to create an Outlook-appointment using .NET VC. My Visual Basic example starts with: Dim oApp As Microsoft.Office.Interop.Outlook.Application = New...
0
by: rdufour | last post by:
In My form declaration I have, I also have a reference set to Microsot office 11 interop outlook Imports Microsoft.Office.Interop.Outlook In my sub I hav code Dim oApp As...
2
by: JC | last post by:
Anybody knows what problem has this code? I think, in the Garbage Collector? You know the Solution? The program in the test's case, whit 350 contacts, run OK before number 86. The error is a...
1
by: allbelonging | last post by:
C#.Net Outlook 2003 automation (programmatically) with Office.Interop.Outlook Problem: I have my outlook 2003 configured with multiple mailbox on my local machine. I want to specify the mailbox...
3
OuTCasT
by: OuTCasT | last post by:
Hi I have created an asp.net project that exports items from datagridview to and outlook calendar This is the code that i have used.. Dim body As String Dim ends As String ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.