marking an incoming message when I am not in the 'To' or the 'Cc'

Status
Not open for further replies.
R

Russ

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
 
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?

"Russ" <Russ> wrote in message

news:BBC6B3E2-0968-4966-A944-D7E2F42C8AEF@microsoft.com...
> 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
 
Re: 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
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?

> >

>

> "Russ" <Russ> wrote in message
> news:BBC6B3E2-0968-4966-A944-D7E2F42C8AEF@microsoft.com...
> >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


>
 
Re: 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

"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
 
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


>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Jay Freedman Outlook forgets "not junk" marking Using Outlook 0
Mary B Outlook 2013: Rule for copying new email to folder & marking that copy as read Using Outlook 1
FirefIy Marking message read only if replied to the message or Ctrl+Q. Possible? Using Outlook 1
A Pull mail without marking and processing, only by selecting it Using Outlook 1
HarvMan Outlook 365 - Rule to Move an Incoming Message to Another Folder Using Outlook 4
E Edit incoming emails to remove a certain sentence added by the "system" Using Outlook 1
Z Outlook 365 Automatically assign categories to incoming mail in a shared folder Round Robin Outlook VBA and Custom Forms 1
L Specific Incoming Email Address Immediately Deleted Using Outlook 2
richardwing Outlook 365 VBA to access "Other Actions" menu for incoming emails in outlook Outlook VBA and Custom Forms 0
T 1:1 Datatransfer from incoming mail body to customs form body Outlook VBA and Custom Forms 0
Aussie Outlook 365 Rule runs manually but returns the error code "an unexpected error has occurred" when incoming mail arrives Using Outlook 1
F Forward incoming email with 4 embedded images in the body without original sender Outlook VBA and Custom Forms 22
R Auto Assign Category colours to Incoming Emails based on whom the email is addressed Outlook VBA and Custom Forms 3
Aussie Rules Run a Script on an Incoming Email OK and then the Email reverts Outlook VBA and Custom Forms 0
C Macro to extract sender name & subject line of incoming emails to single txt file Outlook VBA and Custom Forms 3
e_a_g_l_e_p_i Is it possible it set the fonts used to read incoming mail Using Outlook 25
oliv- How to distinguish whether mail is incoming or outgoing? Outlook VBA and Custom Forms 2
T Search for incoming e-mails for a specified time range Using Outlook 1
G Detect Google Drive and OneDrive links in incoming mail Outlook VBA and Custom Forms 3
D Outlook 2016 customization of incoming messages Using Outlook 1
T Incoming Mail Changes Fonts Using Outlook 0
R VBA to manage incoming mail Outlook VBA and Custom Forms 2
I Capture incoming emails Outlook VBA and Custom Forms 1
S Changing notification sound for new incoming messages in Outlook 365/2016 Using Outlook 1
D VBA to edit body of incoming email and forwarding it Outlook VBA and Custom Forms 11
P Use VBA to alert if new incoming email fits criteria Outlook VBA and Custom Forms 0
A Processing Incoming E-mails with Macros Using Outlook 0
D Delete selected text from incoming emails Outlook VBA and Custom Forms 25
Danny2015 how to change incoming mail conversationtopic successfully Outlook VBA and Custom Forms 6
R IMAP & Outlook 2007: incoming messages still going to old Inbox. Using Outlook 3
A Incoming mail not downloading Using Outlook 2
G Rule starting a VB macro against incoming email Outlook VBA and Custom Forms 3
D Setup expire date for incoming mail Outlook VBA and Custom Forms 2
MattC Some fonts the wrong size in incoming emails in Outlook 2007 Using Outlook 6
C Mark all incoming emails as read Outlook VBA and Custom Forms 3
Emerogork How do I set up an "Incoming mail filter" Using Outlook 12
A Gibberish Titles & Attachments @ incoming Outlook 2013 emails Using Outlook 1
K Ask about a simple script about save a incoming mail as file on local PC Outlook VBA and Custom Forms 3
M Best way to identify/designate contacts in incoming emails? Using Outlook 4
J How to sort incoming email that is sent to a different address to my main one? Using Outlook 1
M Incoming invites to my imap account does not sync to outlook.com Using Outlook.com accounts in Outlook 29
S The incoming task is not valid ((when users are accepting a Task) Using Outlook 5
Commodore Unified inbox or incoming messages view Using Outlook 27
P Automatic reply on incoming messages in outlook using VBA(only Specifi person) Using Outlook 14
A Alerts on incoming emails which are not responded since 1 day Using Outlook 1
J Cannot read incoming emails Using Outlook 2
G Modify Subject line of incoming mail where I am in Cc line Using Outlook 1
J Incoming emails going to wrong sub-folder Using Outlook 4
S Rule to Auto-forward/re-direct a specific incoming email to a group via BCC? Using Outlook 1
F How to change all incoming fonts to black? Using Outlook 3

Similar threads

Back
Top