Option
Explicit
Private
WithEvents
m_objCalFolder
As
Outlook.Folder
Private
m_objDelFolder
As
Outlook.Folder
Private
Sub
Application_Quit()
Set
m_objCalFolder =
Nothing
Set
m_objDelFolder =
Nothing
End
Sub
Private
Sub
Application_Startup()
With
ThisOutlookSession.GetNamespace(
"MAPI"
)
Set
m_objCalFolder = .GetDefaultFolder(olFolderCalendar)
Set
m_objDelFolder = .GetDefaultFolder(olFolderDeletedItems)
End
With
End
Sub
Private
Sub
m_objCalFolder_BeforeItemMove(
ByVal
Item
As
Object
,
ByVal
MoveTo
As
MAPIFolder, Cancel
As
Boolean
)
Dim
bolDel
As
Boolean
If
TypeOf
Item
Is
Outlook.AppointmentItem
Then
If
MoveTo
Is
Nothing
Then
bolDel =
True
ElseIf
MoveTo = m_objDelFolder
Then
bolDel =
True
End
If
End
If
If
bolDel
Then
MsgBox Item.Subject
End
If
End
Sub