View Single Post
  #8  
Old January 12th 08, 03:03 AM posted to microsoft.public.outlook
JP[_3_]
external usenet poster
 
Posts: 201
Default Archive only 'Read e-mails'

Apparently today is my day to repost code over and over! I think
the double negatives are throwing me off. Thank you Brian, here is the
revised (again) code. I do agree with you and suggest something better
to the OP, like posting to the other group (or not leaving emails
unread grin).

But as long as the emails are read from the Inbox, wouldn't it trigger
this code and (eventually) get the msg archived?


Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim objNS As Outlook.NameSpace
Set objNS = Application.GetNamespace("MAPI")
Set Items = objNS.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub Items_ItemChange(ByVal Item As Object)
If (Item.Class = olMail) And (Item.UnRead = False) Then
On Error Resume Next
' Msgbox "Setting do not archive flag now"
Item.NoAging = False
Else
Item.NoAging = True
On Error Goto 0
End if
End Sub


--JP


On Jan 11, 4:51*pm, "Brian Tillman" wrote:

But he wants to archive the read mail. *He doesn't want to archive unread
mail. *The VBA code should add the flag to unread items, not read items.
The problem I see with that, though, it that it would be all too esy to
forget to reenable archiving on the items as they become read. *He's wind up
with nothing being archived as messages aged.
--
Brian Tillman [MVP-Outlook]


Ads