Trapping Outlook reply event

I

Ian

I need to do some processing on every message I reply to in Outlook
2003. I am familiar with vba for Excel. I know I have to use a class
module to trap the event, and that's where I'm getting stuck. I want to
initialise the routine when OL opens so the event is always trapped.
Here's what I have so far:

'This is in a class module: IW_eventclass
Option Explicit
Public WithEvents myItem As MailItem
Sub Initialize_Handler()
Set myItem = Application.ActiveInspector.CurrentItem
End Sub

Private Sub myItem_Reply(ByVal Response As Object, Cancel As Boolean)
'do some processing here
End Sub

'This is in a module: IW_Code
Option Explicit
Public ianseventhandler As New IW_eventclass

Private Sub Application_Startup() 'so it starts when OL opens
'This is where I get stuck - how to declare it so it gets initialised.
'I tried: Set ianseventhandler.myItem = Application
'but get an error.
End Sub

Hope someone can help get this thing declared so I can get on with the
code to process the messages.

Regards
Ian
 
M

Michael Bauer

Am Wed, 04 Jan 2006 09:11:58 -0800 schrieb Ian:

The Application_Startup() event needs to be in ThisOutlookSession, which is
a class module, too.
 

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