Execute Macro on Action

  • Thread starter Thread starter Todd Wilson
  • Start date Start date
T

Todd Wilson

I have written a macro that I would like to have execute
each time the "Delete" action is performed.
Whether "Delete" is done by pressing the "X" in the
toolbar or from the "Edit" menu, either way I would like
my macro to execute.

Any ideas on the best way to do this??
 
Use the Item_Add() event to monitor the "Deleted Items"
folder.

Class module:

Public WithEvents DeletedItems As Outlook.Items

Sub init()
Set DeletedItems = Outlook.Session.GetDefaultFolder
(olFolderDeletedItems).Items
End Sub

Private Sub DeletedItems_ItemAdd(ByVal Item As Object)
' your code
End Sub

Each time an item is added to the Deleted Items folder
the above event sub is executed.
 
Sorry, that won't work in this case since the email never
gets to the Deleted Items folder. The email account is
an IMAP account and my macro does an automatic expunge,
since the delete in an IMAP is a two step process. I am
trying to make it a one step process so that I only hit
the delete button once. Thanks for the reply though.
 
Back
Top