Hook the Inspector Object for Mail Items below:
Implements IDTExtensibility2
'---Object variables for Event procedures declared in OutAddIn class module
Public WithEvents golApp As Outlook.Application
Public WithEvents objNS As Outlook.NameSpace
Public WithEvents objExpl As Outlook.Explorer
Public WithEvents colExpl As Outlook.Explorers
Public WithEvents objInsp As Outlook.Inspector
Public WithEvents colInsp As Outlook.Inspectors
Public WithEvents objMailItem As Outlook.MailItem
Public WithEvents objPostItem As Outlook.PostItem
Public WithEvents objContactItem As Outlook.ContactItem
Public WithEvents objDistListItem As Outlook.DistListItem
Public WithEvents objApptItem As Outlook.AppointmentItem
Public WithEvents objTaskItem As Outlook.TaskItem
Public WithEvents objJournalItem As Outlook.JournalItem
Private Sub colInsp_NewInspector(ByVal Inspector As Outlook.Inspector)
On Error Resume Next
Select Case Inspector.CurrentItem.Class
Case olMail
Set objMailItem = Inspector.CurrentItem
Set objInsp = Inspector
mvarWordEditor = objInsp.IsWordMail
Case olContact
Set objContactItem = Inspector.CurrentItem
Set objInsp = Inspector
Case olAppointment
Set objApptItem = Inspector.CurrentItem
Set objInsp = Inspector
End Select
end sub
I have code for OPen,Write,Save,Forward,Reply,ReplyALL. If an email is open
and the user hits replay, then the reply event fires and I can do something
to the message. If however, the email is not open and the user hits reply
from the toolbar or right-mouse click on the message I only get the Open
event.
I suspose the question would be "should I be hooking the commandbar
Reply/ReplyALL forward command buttons?"
Veriosn: Outlook 2002 SP3. VB6 AddIn.
Thanks
Blair
Dmitry Streblechenko said:
Works just fine here. How do you hook up the events?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool