Matt
2009-07-08 23:00:38 UTC
I am trying to get the PropertyChange event to fire using MS Outlook
2003...
but for some reason it doesn't. Thought I could just set the variable
to the
AppointmentItem and use the WithEvents.
Any help is appreciated. Thanks, Matt (code below)
Option Explicit
Private WithEvents olDeletedItems As Items
Private WithEvents myOlItems As Items
Public WithEvents myAppItem As Outlook.AppointmentItem
Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.GetNamespace("MAPI")
Set olDeletedItems = objNS.GetDefaultFolder
(olFolderDeletedItems).Items
Set myOlItems = objNS.GetDefaultFolder(olFolderCalendar).Items
Set objNS = Nothing
End Sub
Private Sub Application_Quit()
Set olDeletedItems = Nothing
End Sub
Private Sub olDeletedItems_ItemAdd(ByVal Item As Object)
If InStr(1, Item.Subject, "Vacation") Then
MsgBox Item.Subject
End If
Set Item = Nothing
End Sub
Private Sub myOlItems_ItemChange(ByVal Item As Object)
Set myAppItem = Item
End Sub
Private Sub myAppItem_PropertyChange(ByVal Name As String)
If Name = "Subject" Then
MsgBox "yes"
End If
End Sub
2003...
but for some reason it doesn't. Thought I could just set the variable
to the
AppointmentItem and use the WithEvents.
Any help is appreciated. Thanks, Matt (code below)
Option Explicit
Private WithEvents olDeletedItems As Items
Private WithEvents myOlItems As Items
Public WithEvents myAppItem As Outlook.AppointmentItem
Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.GetNamespace("MAPI")
Set olDeletedItems = objNS.GetDefaultFolder
(olFolderDeletedItems).Items
Set myOlItems = objNS.GetDefaultFolder(olFolderCalendar).Items
Set objNS = Nothing
End Sub
Private Sub Application_Quit()
Set olDeletedItems = Nothing
End Sub
Private Sub olDeletedItems_ItemAdd(ByVal Item As Object)
If InStr(1, Item.Subject, "Vacation") Then
MsgBox Item.Subject
End If
Set Item = Nothing
End Sub
Private Sub myOlItems_ItemChange(ByVal Item As Object)
Set myAppItem = Item
End Sub
Private Sub myAppItem_PropertyChange(ByVal Name As String)
If Name = "Subject" Then
MsgBox "yes"
End If
End Sub