![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Sorry! 2007.
"Sue Mosher [MVP]" wrote: Outlook version? -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Kevin" wrote in message news ![]() I am trying to create code in VBA to trigger an event anytime that an AppointmentItem in my calendar is deleted so that I can do some processing. The BeforeDelete event seems to be the one, but I am having trouble figuring out exactly how I would link the event to the the Calendar. In VBA, the only events that I see are the ones assocated with the Application. How do I implement the events for stuff happening in the Calendar? Thanks! Kevin |
#2
|
|||
|
|||
![]()
The event you should use is Folder.BeforeItemMove; see its topic in Help or
in the Outlook Developer Reference at http://msdn.microsoft.com/en-us/library/bb147840.aspx. To see that event in action, put the following code in the built-in ThisOutlookSession module and either restart Outlook or run the Application_Startup procedu Dim WithEvents objCalFolder As Outlook.Folder Dim objDelFolder As Outlook.Folder Private Sub Application_Startup() Set objCalFolder = Application.Session.GetDefaultFolder(olFolderCalen dar) Set objDelFolder = Application.Session.GetDefaultFolder(olFolderDelet edItems) End Sub Private Sub objCalFolder_BeforeItemMove(ByVal Item As Object, ByVal MoveTo As MAPIFolder, Cancel As Boolean) If MoveTo Is Nothing Then Debug.Print Item.Subject & " was hard deleted" ElseIf MoveTo = objDelFolder Then Debug.Print Item.Subject & " was moved to Deleted Items" End If End Sub -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Kevin" wrote in message ... Sorry! 2007. I am trying to create code in VBA to trigger an event anytime that an AppointmentItem in my calendar is deleted so that I can do some processing. The BeforeDelete event seems to be the one, but I am having trouble figuring out exactly how I would link the event to the the Calendar. In VBA, the only events that I see are the ones assocated with the Application. How do I implement the events for stuff happening in the Calendar? Thanks! Kevin |
#3
|
|||
|
|||
![]()
Sorry about the bad line wrapping. Those Set statements can have an
underscore line break in them to make them display better in this newsgroup: Set objCalFolder = _ Application.Session.GetDefaultFolder(olFolderCalen dar) Set objDelFolder = _ Application.Session.GetDefaultFolder(olFolderDelet edItems) "Sue Mosher [MVP]" wrote in message ... The event you should use is Folder.BeforeItemMove; see its topic in Help or in the Outlook Developer Reference at http://msdn.microsoft.com/en-us/library/bb147840.aspx. To see that event in action, put the following code in the built-in ThisOutlookSession module and either restart Outlook or run the Application_Startup procedu Dim WithEvents objCalFolder As Outlook.Folder Dim objDelFolder As Outlook.Folder Private Sub Application_Startup() Set objCalFolder = Application.Session.GetDefaultFolder(olFolderCalen dar) Set objDelFolder = Application.Session.GetDefaultFolder(olFolderDelet edItems) End Sub Private Sub objCalFolder_BeforeItemMove(ByVal Item As Object, ByVal MoveTo As MAPIFolder, Cancel As Boolean) If MoveTo Is Nothing Then Debug.Print Item.Subject & " was hard deleted" ElseIf MoveTo = objDelFolder Then Debug.Print Item.Subject & " was moved to Deleted Items" End If End Sub -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Kevin" wrote in message ... Sorry! 2007. I am trying to create code in VBA to trigger an event anytime that an AppointmentItem in my calendar is deleted so that I can do some processing. The BeforeDelete event seems to be the one, but I am having trouble figuring out exactly how I would link the event to the the Calendar. In VBA, the only events that I see are the ones assocated with the Application. How do I implement the events for stuff happening in the Calendar? Thanks! Kevin |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
AppointmentItem | Fil | Outlook and VBA | 4 | June 13th 08 02:01 PM |
ICS for inserting AppointmentItem | Anup | Outlook - Calandaring | 0 | March 6th 08 09:36 PM |
AppointmentItem BeforeDelete Event | Khyati | Outlook - Using Forms | 2 | June 28th 07 03:10 AM |
Getting Weekday in AppointmentItem | DENNIS BROWN | Outlook and VBA | 1 | June 21st 07 08:10 PM |
How to modify an AppointmentItem? | OctopusThu | Add-ins for Outlook | 6 | December 14th 06 06:13 AM |