Create a class and use it as described below; will work with earlier versions
of Outlook as well.
'Class name = clsMailItemTrapper
'**********************************************************
'USAGE:
'Use this class in ThisOutlookSession as follows:
'Option Explicit
'Dim myMailItemTrapper As clsMailItemTrapper
'Private Sub Application_Startup()
' Set myMailItemTrapper = New clsMailItemTrapper
'End Sub
'**********************************************************
Option Explicit
Dim WithEvents objInspectors As Outlook.Inspectors
Dim WithEvents objOpenInspector As Outlook.Inspector
Dim WithEvents objMailItem As Outlook.MailItem
Private Sub Class_Initialize()
Set objInspectors = Application.Inspectors
End Sub
Private Sub Class_Terminate()
Set objOpenInspector = Nothing
Set objInspectors = Nothing
Set objMailItem = Nothing
End Sub
Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
If Inspector.CurrentItem.Class = olmail Then
'Only look for new messages
Set objMailItem = Inspector.CurrentItem
If objMailItem.Sent = False Then
Set objOpenInspector = Inspector
Else
Set objMailItem = Nothing
End If
End If
End Sub
Private Sub objMailItem_Open(Cancel As Boolean)
objMailItem.Subject = "[SEC=UNCLASSIFIED]"
End Sub
--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog:
http://blogs.officezealot.com/legault/
:
I am required to add [SEC=UNCLASSIFIED] to the subject line of all new emails
in Outlook 2007 - how can I do this automatically\programmatically?