Automating the email archive script

There is no way to actuall schedule an event in Outlook that I know of, however if you add the following code to the same session as the previous sub it will kick off whenever a task with the subject “MOVEOLDEMAILREMINDER” pops a reminder. To set this up create a new task, give it the subject “MOVEOLDEMAILREMINDER” and set a reminder. When the reminder fires, the code below will execute, moving the reminder to a day later. Simply dismiss the reminder popup and your email over 30 days old will have been moved to a personal folder. If you want to run this a week apart instead of daily, just change the DateAdd number from 1 to 7.

Private Sub Application_Reminder(ByVal Item As Object)
Dim objTask As Object
Set objTask = Item
If objTask.Subject = "MOVEOLDEMAILREMINDER" Then
    objTask.ReminderTime = DateAdd("d", 1, objTask.ReminderTime)
    objTask.Save
    MoveOldEmails
End If
Set objTask = Nothing
End Sub

Comments are closed.