Re: marking an incoming message when I am not in the 'To' or the '
Ken,
Many thanks. This is just what I was looking for.
Russ
russ
wrote:
> Put this code in the ThisOutlookSession class module. It uses the new
> flagging for Outlook 2007 and will only run in Outlook 2007. It will run
> when new items come into the Inbox.
> Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
> Dim IDs() As String
> Dim oNS As Outlook.NameSpace
> Dim obj As Object
> Dim oMail As Outlook.MailItem
> Dim i As Long
> Set oNS = Application.GetNamespace("MAPI")
> IDs = Split(EntryIDCollection, ",")
> For i = LBound(IDs) To UBound(IDs)
> Set obj = oNS.GetItemFromID(IDs(i))
> If obj.Class = olMail Then
> Set oMail = obj
> With oMail
> If ((InStr(1, .To, "Joe Foobar", vbTextCompare) = 0) _
> And (InStr(1, .CC, "Joe Foobar", vbTextCompare) = 0)) Then
> ' can be any of the new OlMarkInterval enum members
> .MarkAsTask olMarkNoDate
> .FlagRequest = "Must be Bcc"
> .Save
> End If
> End With
> End If
> Next
> End Sub
> >
>
> "Russ" <Russ> wrote in message
> news:9A6538AB-4AF7-4A09-925E-D1B3BD34347D@microsoft.com...
> > Yes i should have been more explicit. I just want a colored flag next to
> > the
> > email in the inbox list. I am running outlook 2007.
> > > > russ
>