Override the 'To' Button in Outlook

  • Thread starter Thread starter Zengfu Xu
  • Start date Start date
Z

Zengfu Xu

Hi,

I want to override the 'To' button click event in Outlook so that user can
select
a right contact from the list of contact in the organisation other than the
contacts stored in Outlook. Can any one tell me if we can override the 'To'
button click event
using VB so that it would do what we want? If so then how?

Many thnaks!

Zengfu Xu
 
No. That dialog opening event isn't exposed anywhere. You'd have to use
Win32 API calls and callbacks to handle the dialog window opening and send
it a WM_CLOSE message, then you'd have to provide your own dialog in its
place.

You could handle the PropertyChange() event on the item to trap when a
selection is made from the To dialog, but that would be after the fact.

You don't say what version of Outlook you're working with (always do that),
but the Outlook 2007 object model has a NameSpace method
GetSelectNamesDialog() that is the To, etc. dialog. That can be customized
and set up as you like, but to know when To was clicked you'd still need
what I said in the first paragraph of my answer. There's nothing equivalent
in the earlier Outlook object models. although CDO 1.21 does provide a
Session.AddressBook() function that's roughly equivalent to the Outlook 2007
GetSelectNamesDialog() method.

Please do not multipost.
 
Hi Ken,

Thank you very much for your help.

I can use WM_CLOSE message to close the To dialog screen. But how can I use
the Win32 API calls and callbacks to handle the 'To' dialog window ("Select
Names") opening?

Our clients use both Outlook 2003 and Outlook 2007. We do like to provide our
own dialog screen for the contact list otherthan Outlook's address book.

Many thanks

Zengfu Xu
--
Software Developer
Office Automation


Ken Slovak - said:
No. That dialog opening event isn't exposed anywhere. You'd have to use
Win32 API calls and callbacks to handle the dialog window opening and send
it a WM_CLOSE message, then you'd have to provide your own dialog in its
place.

You could handle the PropertyChange() event on the item to trap when a
selection is made from the To dialog, but that would be after the fact.

You don't say what version of Outlook you're working with (always do that),
but the Outlook 2007 object model has a NameSpace method
GetSelectNamesDialog() that is the To, etc. dialog. That can be customized
and set up as you like, but to know when To was clicked you'd still need
what I said in the first paragraph of my answer. There's nothing equivalent
in the earlier Outlook object models. although CDO 1.21 does provide a
Session.AddressBook() function that's roughly equivalent to the Outlook 2007
GetSelectNamesDialog() method.

Please do not multipost.
 
Once you know the window hWnd for that dialog you can close it, to respond
to it opening would require handling all Windows messages looking for
creation of that window (the select names dialog). You'd close that and open
your own dialog. Whether that dialog was an ATL form template or a Windows
Form or whatever in whatever language you're using. Since you'd be creating
that dialog from scratch you would be able to handle its appearance and its
return value.

It's not going to be easy or simple, and you'll have to work out most of the
details yourself.
 
Back
Top