Is there an event in Outlook 2000 and 2003 VBA that occurs when a Calendar Item is added, modified or deleted ?
Printable View
Is there an event in Outlook 2000 and 2003 VBA that occurs when a Calendar Item is added, modified or deleted ?
Yes there are events for all three of your requested events. :D
VB Code:
Option Explicit Public WithEvents oCalFolder As Outlook.items Private Sub Application_MAPILogonComplete() Set oCalFolder = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).items End Sub Private Sub oCalFolder_ItemAdd(ByVal Item As Object) MsgBox "Item: " & Item.Subject & " Added" End Sub Private Sub oCalFolder_ItemChange(ByVal Item As Object) MsgBox "Item: " & Item.subjet & " Modified!" End Sub Private Sub oCalFolder_ItemRemove() MsgBox "Item Deleted" End Sub
It's not firing the event in Outlook 2003. Do I have to do something to activate the macro?
Make sure you have macros enabled and log off and restart Outlook.
What I want to do is when something is add to the personal calendar, it's copied to a public folder. But with these event, I can't do it perfectly. I don't know which one has been deleted and which one has been modified
What do you mean? Item is passed in the Added and Changed events
VB Code:
Private Sub oCalFolder_ItemChange(ByVal [b]Item[/b] As Object)
In the change event, how can I find the original one in the public folder if it changed ?