We are on an exchange server and I use a sub-folder structure contained in a couple of different PST data files; here is an image of the setup. Since I cannot find any other VBA procedures that seem to mark a folder's content as-Read without iterating across each item, I thought I would switch from using Rules to make a copy of the sent message to using VBA. Need to make the copy (after Sending), to a designated folder based on the email address, and mark it as-Read. This is what I've cobbled together so far.
Code: Select all
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim olCopy As MailItem
Dim olFolder As Folder
If TypeName(Item) = "MailItem" Then
Select Case Item.To
Case Is = "litigationinfo@somewhere.com"
Set olFolder = Session.Folders("1 - Delain's Primary email").Folders("HMA - Hugh")
'add cases and appropriate folder names for each recipient email address to be processed
Case Is = "hugh@somewhere.com"
Set olFolder = Session.Folders("1 - Delain's Primary email").Folders("HMA - Hugh")
Case Is = "craig@somewhere.com"
Set olFolder = Session.Folders("1 - Delain's Primary email").Folders("HMA - Craig")
'add cases and appropriate folder and sub folder names for each recipient email address to be processed
Case Else: Set olFolder = Nothing
End Select
If Not olFolder Is Nothing Then
Set olCopy = Item.Copy
olCopy.UnRead = False
olCopy.Move olFolder
End If
End If
lbl_Exit:
Set olCopy = Nothing
Exit Sub
End Sub
What might I need to change?
Thanks in advance,
Delain