Objective: To create an Outlook folder that accepts new messages and deletes older messages with the same subject line.
Requires: Outlook (I'm running 2002) and Redemption, to avoid access warnings.
To use: Create a folder called "Tracked Pages" under your Outlook Inbox. Copy the VBA below into your "ThisOutlookSession".
Possible application: This can be used for page tracking. For example, the user can have Internet Explorer email himself when pages have changed. First set up page tracking in IE:
and is the first rule processed in my Outlook list.
Code:
Requires: Outlook (I'm running 2002) and Redemption, to avoid access warnings.
To use: Create a folder called "Tracked Pages" under your Outlook Inbox. Copy the VBA below into your "ThisOutlookSession".
Possible application: This can be used for page tracking. For example, the user can have Internet Explorer email himself when pages have changed. First set up page tracking in IE:
- right-click on a Favorite
- choose Properties
- make the page available offline
- choose Download
- check "When this page changes..."
- complete the fields.
Outlook Rule |
Code:
Dim objNameSpace As NameSpace
Private WithEvents myTPFolder As Items
Private Sub myTPFolder_ItemAdd(ByVal Item As Object)
Dim i As Integer
Dim safeMail
Set safeMail = CreateObject("Redemption.SafeMailItem")
For i = 1 To myTPFolder.Count
Set safeMail = myTPFolder.Item(i)
If (Item.Subject = safeMail.Subject And Item.SentOn > safeMail.SentOn)
Then safeMail.Delete
Next
Set safeMail = Nothing
End Sub
Private Sub Application_Startup()
Set objNameSpace = Outlook.Application.GetNamespace("MAPI")
Set myFolders = objNameSpace.GetDefaultFolder(olFolderInbox)
Set myTPFolder = myFolders.Folders("Tracked Pages").Items
Set myFolders = Nothing
End Sub
Private Sub Application_Quit()
' disassociate global objects declared WithEvents
Set myTPFolder = Nothing
End Sub