L
Lars Moastuen
I have a macro (in ThisOutlookSession) to trap a delete mail-event.
This works fine, but only for one folder (the inbox that is)... What I
want is a event-trap that traps all delete mail-events. I guess I have
to do some kind of recurssion using
Application.GetNamespace("MAPI").Folders, but how do I add events to
these sub-folders dynamiclly?
My code is as follows:
---
Private WithEvents olInboxItems As Items
Private Sub Application_Startup()
Call Initialize_handler
End Sub
Private Sub Initialize_handler()
Set olInboxItems =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub olInboxItems_ItemRemove()
MsgBox 'Do something'
End Sub
This works fine, but only for one folder (the inbox that is)... What I
want is a event-trap that traps all delete mail-events. I guess I have
to do some kind of recurssion using
Application.GetNamespace("MAPI").Folders, but how do I add events to
these sub-folders dynamiclly?
My code is as follows:
---
Private WithEvents olInboxItems As Items
Private Sub Application_Startup()
Call Initialize_handler
End Sub
Private Sub Initialize_handler()
Set olInboxItems =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub olInboxItems_ItemRemove()
MsgBox 'Do something'
End Sub