Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   marking an incoming message when I am not in the 'To' or the 'Cc' (http://www.outlookbanter.com/outlook-vba/93492-marking-incoming-message-when-i.html)

Russ August 7th 09 01:43 AM

marking an incoming message when I am not in the 'To' or the 'Cc'
 
I have written a lot of VBA code in excel but not in Outlook.

I would like to mark incoming messages that I recieve with a color if I am
not in the 'To' list or the 'Cc' list (which means I got the message as a
'Bcc'). I looked over using rules but they fall just short.
--
russ

Ken Slovak - [MVP - Outlook] August 7th 09 03:02 PM

marking an incoming message when I am not in the 'To' or the 'Cc'
 
Do you mean mark it with a colored flag or with a colored format in the
folder view? There's no code access to setting up an autoformat for a view
that will color specific items.

What version of Outlook?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Russ" wrote in message
...
I have written a lot of VBA code in excel but not in Outlook.

I would like to mark incoming messages that I recieve with a color if I am
not in the 'To' list or the 'Cc' list (which means I got the message as a
'Bcc'). I looked over using rules but they fall just short.
--
russ



Russ August 7th 09 03:51 PM

marking an incoming message when I am not in the 'To' or the '
 
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


"Ken Slovak - [MVP - Outlook]" wrote:

Do you mean mark it with a colored flag or with a colored format in the
folder view? There's no code access to setting up an autoformat for a view
that will color specific items.

What version of Outlook?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Russ" wrote in message
...
I have written a lot of VBA code in excel but not in Outlook.

I would like to mark incoming messages that I recieve with a color if I am
not in the 'To' list or the 'Cc' list (which means I got the message as a
'Bcc'). I looked over using rules but they fall just short.
--
russ




Ken Slovak - [MVP - Outlook] August 7th 09 05:48 PM

marking an incoming message when I am not in the 'To' or the '
 
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

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Russ" wrote in message
...
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



Russ August 7th 09 06:37 PM

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


"Ken Slovak - [MVP - Outlook]" 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

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Russ" wrote in message
...
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





All times are GMT +1. The time now is 12:21 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com