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
*** Sent via Developersdex http://www.developersdex.com ***
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
*** Sent via Developersdex http://www.developersdex.com ***