I've written a VSTO addin for Word 2003 which is working correctly. The only problem is that the addin displays a commandbar which is also appearing when I create a new email in Outlook. How can I prevent the commandbar addin from displaying in the context of Outlook and only in Word?
4 Answers
The parent property just keeps looping back to Microsoft Word, and never to Outlook. I ended up importing User32.dll and getting the windows name, and then checking to see if that contained Microsoft Word.
The only problem I am still having is that if a user opens Outlook, creates a new message, and then opens Word, the WINWORD.exe process still has what im assuming to be the default template, and therefore the new copy word will not show my plugin.
There's several properties in Word that should let you detect whether it's being run as a mail editor or not.
App.MailEnvelope App.Envelope App.Email
All return email related information. I believe at least one of them will return NOTHING if word is NOT being used as an email editor, but I no longer have access to that code, so I couldn't be sure without trying it out.
That said, I do know that even MS recommends against using Word as email editor. in Office 2007 and 2010, I don't believe that's even an option anymore.