How to keep Word COM add-in from loading when Outlook starts?

D

dcjohnson8950

How can I keep a Word COM add-in from loading when Outlook starts? A
toolbar I have created in Word doesn't apply to the Outlook
e-mail editor. I tried debugging into the startup code
(AddinInstance_OnConnection) but found no reference to Outlook.

Also, I don't want to remove Word as the e-mail editor.


Thanks,
CJ
 
X

XL-Dennis

Hi CJ,

This is an interesting challenge and one possible solution may be to change
how it is loaded.

Instead of 'Load on startup' it may be better to use 'Load on demand'.
However, it will require some interface to get it loaded, i e a button.

Will this be a workable solution?
 
K

Ken Slovak - [MVP - Outlook]

If WordMail is being used you can't prevent it from loading and doing so
might prevent it from loading when a Word doc was loaded.

You can use the WindowActivate event to check for Window.EnvelopeVisible. If
True you have an email item, if not it's a Word item. Disable/enable your
controls based on that.
 
C

CJohnson

Dennis, the current requirements are to load the add-in at startup, and
adding another button or menu item to start our add-in might be
confusing to our user group. Thank you for the suggestion.

Ken, the EnvelopeVisible flag seems like a good place to start.
Thanks! My toolbar creation code is called from
AddinInstance_OnConnection so I will see if I can detect it before that
time. I may have to move some code around, or implement some events I
hadn't planned to but this appears to be something I can work with.

Thanks,
CJ
 
K

Ken Slovak - [MVP - Outlook]

You will only get WindowActivate for WordMail when the user opens an
Inspector (window to display an item), not before then. For Word, if you
open a document you will get that event. OnConnection is way too early to
get that event or to tell if the user is going to open an email item.

I just leave my addins running, showing or not showing the appropriate
menus/toolbars/buttons depending on whether or not .EnvelopeVisible = True.

I have a set of addins I'm writing now that has both Outlook and
Word/Excel/PPT addins. Both are always enabled and both would start if the
user opened Outlook with WordMail enabled. What menu items are displayed are
totally dependent on what's opened where.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top