![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hi,
Is there a way to defined AutoArchiving to only archive read emails older than a certain period? |
Ads |
#2
|
|||
|
|||
![]()
Nabeel wrote:
Is there a way to defined AutoArchiving to only archive read emails older than a certain period? That's exactly what AutoArchive does, with one exception: it doesn't distinguish between read and unread. Any message whose modification date is older than the archive date you choose will be archived. -- Brian Tillman [MVP-Outlook] |
#3
|
|||
|
|||
![]()
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 On Jan 11, 9:16*am, Nabeel wrote: Hi, Is there a way to defined AutoArchiving to only archive read emails older than a certain period? |
#4
|
|||
|
|||
![]()
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 On Jan 11, 9:16*am, Nabeel wrote: Hi, Is there a way to defined AutoArchiving to only archive read emails older than a certain period?- Hide quoted text - - Show quoted text - |
#5
|
|||
|
|||
![]()
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 |
#6
|
|||
|
|||
![]()
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. 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] |
#7
|
|||
|
|||
![]()
Sorry that should be
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 = True On Error Goto 0 End if End Sub On Jan 11, 4:41*pm, JP wrote: You may want to post your question in microsoft.*public.*outlook.* program_vba. |
#8
|
|||
|
|||
![]()
Apparently today is my day to repost code over and over!
![]() 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] |
#9
|
|||
|
|||
![]()
Brian, JP,
Thanks for the code and the suggestion. On Jan 12, 7:03*am, JP wrote: Apparently today is my day to repost code over and over! ![]() 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]- Hide quoted text - - Show quoted text - |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
E-mails Being Deleted When Moving From Archive to Inbox | Jason H.[_2_] | Outlook - General Queries | 1 | October 1st 07 08:57 PM |
cannot read mails in HTML Format | Alper Ozgur | Outlook - General Queries | 1 | March 20th 07 12:28 PM |
Cannot read e-mails with OE6 | Jim Terry | Outlook Express | 1 | December 1st 06 12:44 AM |
Can't read e-mails | RLM | Outlook Express | 2 | May 9th 06 01:13 AM |
e-mails being read as soon as it's downloaded | Peter McCaul | Outlook - General Queries | 1 | April 12th 06 05:09 AM |