View Single Post
  #2  
Old January 2nd 07, 06:46 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default hooking the insert-File menu command (add attachment) in outlook 2003 (c# add in)

It looks like Outlook is using id = 1079 in Outlook 2002 and id = 777 in
Outlook 2003 (both Word editor, didn't check any otherversions).
To make sure your code only depends on the Outlook version rather than a
locale, do not use the menu names, use CommandBars.FindControl instead and
specify the control id:

set btn = inspector.commandbars.findcontrol( ,777)
btn.execute

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"semedao" wrote in message
...
Hi all,
I try to replace the regular add file dialog that open when clicking in
the
Attach button.
I used code that :
1. get fired whenever I open new Email form (NewInspector)
2. get the CommandBar using
InsertCommandBar = Inspector.CommandBars["Insert"];

3. using

(CommandBarButton)InsertCommandBar.FindControl(myM issing, id, myMissing,
myMissing, true);

to get the CommandBarButton that is clicked to insert new attachment.

and then I register to it's _CommandBarButtonEvents_ClickEventHandler

it's work well when the id paramenter whas 1079

than in other outlook languges versions , or other windows language
version
it's stop to work because or the :

InsertCommandBar = Inspector.CommandBars["Insert"];

statement return null , or the id was not 1079....

my question...

how can I determine for the correct values that are the same in all
versions
to handle it?

and also , how can I catch the insert attachment button that's appear in
the
side of the subject ?





Ads