MailItem

  • Thread starter Mike via OfficeKB.com
  • Start date
M

Mike via OfficeKB.com

Is it possible to have a custom event fire when the TO button is pressed on
the Outlook mail form(MailItem). That is have a form pop up that I have
created in my addin. I have the form pop up currently when a button I
created on the toolbar is pressed, but I want it to pop up when the To
button is pressed. I am using VB6.

I was also wondering how I can keep my custom button from being added more
than once when Word is used as the mail editor. I have read about the
problem, but havent been able to figure out the solution.

Thanks alot,
Mike
 
K

Ken Slovak - [MVP - Outlook]

There is no event that fires when the To button is pressed. There isn't even
an event that fires when a recipient is added to a mail item.

WordMail items don't know anything about temporary buttons, as Outlook items
do. So you must trap when the item is being closed or sent and when the
Inspector is being closed and trap those events and explicitly delete your
button at that time. You will also run into the problem that adding a button
modifies the normal.dot template and the user will be prompted to save it if
they have that option enabled.

To avoid that you must get a handle to
Inspector.WordEditor.Application.CustomizationContext.Saved and set that
Boolean to True after you add your button and again after deleting it. More
sophisticated code would maintain a variable to track that setting and test
it before adding your button and before deleting it to see if you really
need to set that property.

Also, in some secure versions of Outlook such as Outlook 2003 the
Inspector.WordEditor object (which is a Word Document object) is restricted,
so to avoid the security prompts you would have to use something like
Redemption's SafeInspector object (Redemption: www.dimastr.com/redemption).
 
M

Mike via OfficeKB.com

Thanks alot for the quick response, and helpful information. I kinda
figured the to thing wouldnt work after much searching.

thanks again

-Mike
 

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