A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

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



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 7th 09, 01:43 AM posted to microsoft.public.outlook.program_vba
Russ
external usenet poster
 
Posts: 23
Default 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
Ads
  #2  
Old August 7th 09, 03:02 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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


  #3  
Old August 7th 09, 03:51 PM posted to microsoft.public.outlook.program_vba
Russ
external usenet poster
 
Posts: 23
Default 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



  #4  
Old August 7th 09, 05:48 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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


  #5  
Old August 7th 09, 06:37 PM posted to microsoft.public.outlook.program_vba
Russ
external usenet poster
 
Posts: 23
Default 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



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Incoming message content Gene L.[_2_] Outlook - General Queries 0 October 23rd 08 08:26 PM
how do I get incoming message to display normally ? Gary Outlook - General Queries 2 September 15th 08 09:29 PM
Incoming Message MEG Outlook and VBA 5 July 16th 08 08:04 PM
Marking a Message Private in Outlook 2003 Stars Outlook - General Queries 3 December 22nd 06 09:32 PM
Outlook on IMAP not marking message as "to be deleted" [email protected] Outlook - General Queries 2 October 9th 06 11:07 AM


All times are GMT +1. The time now is 02:49 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.