Detecting form control events from an add-in

  • Thread starter Thread starter Errol Limani
  • Start date Start date
E

Errol Limani

General Outlook question...say you customize the contacts
form by adding a command button to it. Is it possible for
an add-in running in the background to detect the click
event on that button? I know this can be done in VBScript
directly behind the form but I'm not sure if it can be
done from within the add-in as well, or what that
requires. Thanks, Errol
 
You might be able to handle the button's click event, although I've never
tried doing something like that. Get the button in your code from the
Controls collection of the ModifiedFormPages collection for the page where
the button is located. The button is a CommandButton object in the MS Forms
2.0 library, although I've had the most luck in getting objects from that
library as Object (late bound) rather than trying to get them as early bound
objects (MSForms.CommandButton).

Once you have assigned the button to an Object declared WithEvents you might
be able to catch its Click event. Use the Object Browser on the MS Forms 2.0
library to see what objects, properties, methods and events are available to
you and what syntax to use to work with them. The Page object you get from
the ModifiedFormPages collection is the Page object from MS Forms.
 
Hi Ken/All,

I have designed the Message form having lot of different controls. I have
following issues

1- I have default To Field, How can i get email address and name for some
contact displayed in To Field. I can't get values liek any other Textbox.
2- I have a Combo Box on the form. When the selection changes in the combo -
Can i catch this event in Addin code ? If YES then i need to make changes to
couple of textboxes on the form. Can i make those changes from within the
Addin code ?

I am using C++ - So any relevent code snippet will be appreicated.

Regards
Nauman
 
You can access the Recipients collection and get each Recipient.Address,
although the access is restricted in secure versions of Outlook, as is
access to the To property. To avoid the security you'd have to use the
Exchange security form or Extended MAPI code or Redemption
(www.dimastr.com/redemption).

To get a change in the combo if it's bound to a user property to preserve
the value you can use the CustomPropertyChange event handler in the form
code. The Name argument passed in that event handler is the name of the
control that changed.

I don't do C++ so I can't show you any code for that.
 
Back
Top