We have a C# Outlook Add-in which allows end user to click one button in Ribbon to insert some contents on new email. We are using MailItem.GetInspector.WordEditor to do so. However the weird thing is that our program is not able to get the WordEditor all the time. So far, it is only on my machine.
we would get exception like this
System.Runtime.InteropServices.COMException (0x9CD04005): The operation failed.
at Microsoft.Office.Interop.Outlook._Inspector.get_WordEditor()
the last 4 digit is always 4005 while the first 4 could be changing. The first 4 should refer to the component where the error occurred.
I installed the outlookspy on my machine and it could not get WordEditor as well.
I did some search over internet and found out this link: system.Runtime.InteropServices.COMException (0xB5904005): The operation failed, so it suggests that we would get the WordEditor on Activate event to make sure WordEditor is fully initialized, however on new email, it should already be activated per our understanding unless we are missing something here. Plus I have run OUtlookSpy multiple times on a new email and each time WordEditor is null there. So it seems that it should not be initialization issue.
Could someone shed some lights on what we should investigate here?
You may find my solution a bit odd, but it worked.
"Microsoft VBA for Outlook Addin" appeared to be disabled for some reason. I enabled it and the problem disappeared.
To be honest, I can't find a logical explanation for this behavior.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With