Oh Yeah!
Ok try this one. I can place a break in the class to step through, and it works. I stop outlook and restart it it asks if I want to enable macros I pick enable macros and it complains or does nothing. The folder does not move.
I can only get it to work about 3 times in step mode.
And Yes I butchered some help files
Anyway if some one else wants to play:
In a class1
[VBA]
Dim myolapp As New Outlook.Application
Dim WithEvents myFolders As Outlook.Folders
Sub Initialize_handler()
Dim myNs As NameSpace
Set myNs = myolapp.GetNamespace("MAPI")
Set myFolders = myNs.GetDefaultFolder(olFolderInbox).Folders
End Sub
Private Sub myFolders_FolderRemove()
Dim MvitBck As Outlook.Folders
Dim myNs As NameSpace
Set myNs = myolapp.GetNamespace("MAPI")
Set MvitBck = myNs.GetDefaultFolder(olFolderDeletedItems).Folders
For i = 1 To MvitBck.Count
If Not MvitBck("kepfromdelete") Is Nothing Then
On Error Resume Next
MvitBck("kepfromdelete").MoveTo myNs.GetDefaultFolder(olFolderInbox)
Err.Clear
On Error GoTo 0
End If
Next
Set MvitBck = Nothing
End Sub
[/VBA]
In ThisOutlookSession
[VBA]
Private AllDay As Class1
Private Sub Application_Startup()
Set AllDay = New Class1
AllDay.Initialize_handler
End Sub
[/VBA]