A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

AppointmentItem.BeforeDelete Event



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 9th 09, 10:14 PM posted to microsoft.public.outlook.program_vba
Kevin
external usenet poster
 
Posts: 85
Default AppointmentItem.BeforeDelete Event

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  
Old July 9th 09, 11:01 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default AppointmentItem.BeforeDelete Event

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



  #3  
Old July 9th 09, 11:07 PM posted to microsoft.public.outlook.program_vba
Kevin
external usenet poster
 
Posts: 85
Default AppointmentItem.BeforeDelete Event

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




  #4  
Old July 9th 09, 11:27 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default AppointmentItem.BeforeDelete Event

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






  #5  
Old July 9th 09, 11:34 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default AppointmentItem.BeforeDelete Event

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
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


All times are GMT +1. The time now is 06:49 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.