I wrote the VBA script using resources from StackOverflow and SuperUser if anyone is interested.
This script takes all incoming emails and counts the recipients in the
To: field,if recipient count is greater than 5, marks it as read, and moves is to a
There is also a secondary condition to check if subject contains
CVS (we get updates from our concurrent version system which has 10 recipients) and move is to the appropriate folder.
Sub moveOfficeGossip(item As Outlook.MailItem)
Dim strNames As String, i As Integer, j As Integer, cvs As String
Dim olApp As New Outlook.Application
Dim olNameSpace As Outlook.NameSpace
Dim olDestFolder As Outlook.MAPIFolder
j = 1
cvs = "CVS"
strNames = item.To
Set olNameSpace = olApp.GetNamespace("MAPI")
For i = 1 To Len(strNames)
If Mid(strNames, i, 1) = ";" Then j = j + 1
If (j >= 5) Then
If InStr(UCase(item.subject), cvs) Then
Set olDestFolder = olNameSpace.Folders("Personal Folders").Folders("Filtered").Folders("CVS")
Set olDestFolder = olNameSpace.Folders("Personal Folders").Folders("Filtered").Folders("Gossip")
item.UnRead = False
I apologize if this is not in the most formal format and I know that it can be organized a bit better, but this was my first attempt at using any Visual Basic syntax.