Archive only 'Read e-mails'
You may want to post your question in microsoft.*public.*outlook.*
program_vba.
To get you started, you would need to check the ItemChange event for
your Inbox and see if the "Read" property of an email changes. If it
does, set the flag so it won't be archived. This code is a bit crude
so hopefully someone else will be able to refine it for you.
For example:
Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
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 = True
On Error Goto 0
End if
End Sub
HTH,
JP
On Jan 11, 4:27*pm, Nabeel wrote:
I think you meant setting the 'Do Not archive' on 'unread emails'
and then there would be another piece of code to fire on the event
when the msg turns to 'read'.
anyone who can help with the code?
On Jan 12, 1:13*am, JP wrote:
One workaround would be to write some VBA code to set the "Do Not
Archive" flag on Read emails, then when you click on FileArchive,
uncheck "Include items with "Do not AutoArchive" checked." so those
emails would not be moved to archive.
HTH,
JP
|