The easiest way to handle events in Outlook VBA code is to use the
ThisOutlookSession class module, which is always in scope.
To get events on an appointment you need to handle first NewInspector() to
instantiate an event handling item and then handle events on the item.
In ThisOutlookSession, at the class level:
Dim WithEvents colInsp As Outlook.Inspectors
Dim WithEvents oAppt As Outlook.AppointmentItem
Private Sub Application_Startup()
Set colInsp = Application.Inspectors
End Sub
Private Sub colInspectors_NewInspector(Inspector As Inspector)
If Inspector.CurrentItem.Class = olAppointment Then
Set oAppt = Inspector.CurrentItem
End If
End Sub
That will instantiate the appointment object as an event handling object and
you then can handle the Close() and Write() events on the item.
"Jan T." <noreply> wrote in message
news:OK2dnXJt0NUAd63RnZ2dnUVZ_uwAAAAA@posted.comnet...
> Hi. I want to run a procedure Sub MyProc() when I save or close an
> appointment
> that I just have created. I know there are some Events that are triggered,
> but how
> can I write code to make use of those Events?
>
> Class AppointmentItem
> Event Close(Cancel As Boolean)
> Event CustomAction(Action As Object, Response As Object, Cancel As
> Boolean)
>
> I appreciate very much any help, examples or suggestions. Thank's in
> advance!
>
> Regards
> Jan T.
>
>