David Fisco

03 Jul 2006

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:
  1. right-click on a Favorite
  2. choose Properties
  3. make the page available offline
  4. choose Download
  5. check "When this page changes..."
  6. complete the fields.
Then, set up a filter in Outlook to place the messages into "Tracked Pages". My rule looks like this
Outlook Rule
and is the first rule processed in my Outlook list.


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
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