Re: How do I catch Outlook 2000 MailItem Reply Event
From: Ken Slovak - [MVP - Outlook] (kenslovak_at_mvps.org)
Date: 05/06/04
- Next message: Trev: "Email from Access"
- Previous message: Ken Slovak - [MVP - Outlook]: "Re: Searching through Items with created Property (DisplayFormat = FALSE)"
- In reply to: Russell Mangel: "Re: How do I catch Outlook 2000 MailItem Reply Event"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 6 May 2004 10:17:51 -0400
Well, for an Explorer wrapper class and associated code to implement it in
VB 6 see the ItemsCB sample addin on the Resources page at www.microeye.com
That not only has a wrapper but also has many workarounds for common Outlook
COM addin bugs and limitations.
If you took the Explorer wrapper and added code to the SelectionChange event
handler for the Explorer in the wrapper class you could instantiate a mail
item that is Selection.Item(1). You would just place a Private WithEvents
oMail As Outlook.MailItem in the module declarations section of the class
and then in the init code and in Selection change use: Set oMail =
m_objExpl.Selection.Item(1) to instantiate the change in what's selected.
Then you would have event handlers in the wrapper class for whatever mail
item events you wanted to handle, such as Reply.
The principle would be the same for a Selection collection wrapper as with
the Explorer wrapper (or Items or buttons or whatever other collection you
wanted to wrap). Inside the Explorer wrapper you would handle
SelectionChange and in that event handler:
1. Clear the collection first so no previously selected items are in the
collection. Easy to do using New clsSelectionWrapper.
2. Get each item selected in a loop.
3. For each item add it to a collection using a unique Key value to maintain
a unique collection. I would probably use item.EntryID as my Key value.
The class that was added to the collection would include a WithEvents
declaration for a MailItem so its events could be handled.
Of course that's just an outline, and it will mean more to you once you've
studied ItemsCB. I've also posted an Inspector wrapper many times in these
groups, so you can google for that too.
What I would also do is add some sanity checking like not instantiating the
Selection class if the Explorer.CurrentFolder wasn't an email folder,
checking each selection item to make sure it's a mail item (Inbox can have
other item types come into it like task and meeting requests) and so on.
-- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Russell Mangel" <russell@tymer.net> wrote in message news:OpZd9AxMEHA.3572@tk2msftngp13.phx.gbl... > Thanks, this explains why I was unable to catch the event when the Outlook > Item is not open. > Now, I have to find some code that wraps all this up... I am a very poor at > VB6, (I use C++/C#). > Do you have VB6 sample (class module, or what ever it's called in VB6)? > > Thanks > Russell Mangel > Las Vegas, NV
- Next message: Trev: "Email from Access"
- Previous message: Ken Slovak - [MVP - Outlook]: "Re: Searching through Items with created Property (DisplayFormat = FALSE)"
- In reply to: Russell Mangel: "Re: How do I catch Outlook 2000 MailItem Reply Event"
- Messages sorted by: [ date ] [ thread ]