Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MailItem.GetInspector.WordEditor is NULL on Outlook 2013 AddIn all the time

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.
enter image description here

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?

like image 364
windfly2006 Avatar asked Mar 13 '23 02:03

windfly2006


1 Answers

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.

like image 126
Dobry Avatar answered Apr 09 '23 01:04

Dobry