Detecting send as attachment from Word

  • Thread starter Thread starter jim_adams
  • Start date Start date
J

jim_adams

I've developed a VB6 COM add-in that displays on the new message
toolbar in Outlook 2003. However, its code does not
get called when a file is sent to a recipient as an attachment from
Word, probably since the resulting email window is in MAPI mode.

Is there a way for an Outlook COM add-in to be called in the above
scenario?

As it so happens <g>, I've also developed an extended MAPI add-in that
will display in the above scenario.

My problem is that I don't want both buttons displaying on the same
toolbar when messages are created from Outlook.

I've tried to have my COM add-in delete the extended MAPI button from
the Standard toolbar when it loads, but the extended MAPI button is the
only button that doesn't delete!

So then, I've tried to determine the parent window of my extended MAPI
button. If it's Outlook don't show it since my COM button will work.
And if it's Word, show since I know the COM button won't show. Sounds
good, but I can't find a way to detect whether Outlook's new message
window is spawned from Outlook or Word.

Grrrrrr.

Any help is greatly appreciated!!!

-Jim
 
It sounds look your Outlook add-in is able to detect the ExMAPI button, it
just can't delete it. Is that correct? If so, why not have the COM add-in
check for the presence of your ExMAPI button when a new Inspector opens and
only add its own button if it doesn't find the ExMAPI button?
 
Hi Dave,

That's a great suggestion. However, the COM button has some
significant advantages over the extended MAPI version including

* position is controllable (next to Send) on standard toolbar (ExMAPI
is only at end)
* button includes text next to its icon
* VB6 code w/Outlook object model has proven more capable than ExMAPI
C++ version
* the strategic direction is to add more capabilties to the COM
version.

It's so close to being an ideal universal add-in... just one step away!

Thanks for your insight.

Jim
 
Jim,

For the IDExtensibility methods, they have an array argument custom()
passed. In the _OnConnection function the element in custom(1) is an
integer that indicates how the COM addin was instantiated: 1 = Outlook;
<>1 = Other application eg Word.

I have now come across a slightly different problem with my own VB6
addin. When it initiates, I set up a listener on the Sent Items folder.
However, if I send a mail as an attachment from Word, whilst Outlook is
shutdown, the addin crashes as soon as I try and access the
objApp.GetNamespace("MAPI").Folders.GetFirst object. In fact anything
other than the objApp.GetNamespace("MAPI").Folders.Count property
fails! Any ideas??

Hope this helps!
Paul
 
Hi Paul,

Thanks for the tip. In my case, however, the exMAPI add-in will load
from Outlook and also from "Send as Attachment" from Word. I don't
want it to load from Outlook since my more feature-rich COM button will
load then.

So I need to determine where the exMAPI button on the new message
window is loaded from, and not load if the parent is Outlook.

As for your issu with folders, I haven't had the reason to dabble in
that area so am not able to help out. Sorry.

-Jim
 
Back
Top