Fixed font Subject: converted from outlook2003 to outlook2007, thismessageitem automatic process
Author: nina Date: 04 Apr 2011
References:
All of our office systems were upgraded from outlook2003 to outlook2007

I used to run for each incoming email, a short vba code that would simply
log the headers to a drive but can't remember now how I initialized it?

Can someone help me?

Basically, I want to run a simple piece of vba code, similar to snippet
below and have this run for every incoming email

I inserted the code via Alt-F11 and saved it but can't remember how do I set
the rule to run this when mail arrives.


Sub CustomMailMessageRule(ByVal Item As MailItem)

On Error GoTo CustomMailMessageRule_Error

Dim olNS As Outlook.NameSpace

Set olNS = Application.GetNamespace("MAPI")

Dim Msg As Outlook.MailItem

strID = Item.EntryID
Set Msg = olNS.GetItemFromID(strID)

' write routine goes here, no problems with that

CustomMailMessageRule_Error:

Exit Sub

End Sub