M
M. Brown
The macro below works in conjunction with a rule that copies each email I
send in a specific personal folder. As soon as the email copy is placed in
the personal folder, the macro below sets UnRead = False on the email copy.
This works great until I send an encrypted email. The rule copies the
encrypted email to the correct personal folder but the macro fails at
"Item.UnRead = False". I get a message that says "Run-time error
'-2147217660 (80040F04)':" / "Method 'UnRead' of object 'MailItem' failed.
Thanks in advance for any tips you can provide!
----------------------------------
Public WithEvents myOlItems2 As Outlook.Items
Public Sub Application_Startup()
Set myOlItems2 = Outlook.Session.Folders("Personal
Folders").Folders("Inbox").Folders("Sent (2007)").Items
End Sub
Public Sub myOlItems2_ItemAdd(ByVal Item As Object)
Dim myOlAppSub As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim mySentFolder As Outlook.MAPIFolder
Set myOlAppSub = CreateObject("Outlook.Application")
Set myNameSpace = myOlAppSub.GetNamespace("MAPI")
Set mySentFolder = myNameSpace.Folders("Personal
Folders").Folders("Inbox").Folders("Sent (2007)")
Item.UnRead = False
End Sub
send in a specific personal folder. As soon as the email copy is placed in
the personal folder, the macro below sets UnRead = False on the email copy.
This works great until I send an encrypted email. The rule copies the
encrypted email to the correct personal folder but the macro fails at
"Item.UnRead = False". I get a message that says "Run-time error
'-2147217660 (80040F04)':" / "Method 'UnRead' of object 'MailItem' failed.
Thanks in advance for any tips you can provide!
----------------------------------
Public WithEvents myOlItems2 As Outlook.Items
Public Sub Application_Startup()
Set myOlItems2 = Outlook.Session.Folders("Personal
Folders").Folders("Inbox").Folders("Sent (2007)").Items
End Sub
Public Sub myOlItems2_ItemAdd(ByVal Item As Object)
Dim myOlAppSub As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim mySentFolder As Outlook.MAPIFolder
Set myOlAppSub = CreateObject("Outlook.Application")
Set myNameSpace = myOlAppSub.GetNamespace("MAPI")
Set mySentFolder = myNameSpace.Folders("Personal
Folders").Folders("Inbox").Folders("Sent (2007)")
Item.UnRead = False
End Sub