how to send cancelation before deleting appointment

sspreyer

Registered User.
Local time
Today, 02:10
Joined
Nov 18, 2013
Messages
251
hi all

I have some code below I run on a form in access that can delete calendar appointment in outlook I just wonder how can I adapt this to send cancelation before deleting appointment for my outlook


here's my code so far:

Code:
              Dim goldLocation As String
             Dim goldStart As Date
             Dim goldDate As Date
             Dim goldName As String

            
  ' Connection to Outlook Variables
 
                 Dim objOlook As Outlook.Application
                 Dim objNamespace As Outlook.NameSpace
                 Dim objFolder As Outlook.MAPIFolder
                 Dim objAppointment As Outlook.AppointmentItem
                 Dim objOAppt As Outlook.Items
                 Dim lngDeletedAppointements As Long
                 Dim strSubject As String
                 Dim strLocation As String
                 Dim dteStartDate As Date
  '******************************** Set Criteria for DELETION here ********************************
                 strSubject = Me.cbocoursesubject
                 strLocation = Me.cbolocation
                 dteStartDate = Me.txtdatedue & " " & Me.txtcourseTime
    ' goldDate is Short Date goldStart is medium time
                  MsgBox (strSubject & dteStartDate & strLocation)
 '************************************************************************************************
                Set objOlook = CreateObject("Outlook.Application")
              Set objNamespace = objOlook.GetNamespace("MAPI")
              Set objFolder = objNamespace.GetDefaultFolder(olFolderCalendar)
              For Each objAppointment In objFolder.Items
 
             If objAppointment.Subject = strSubject And objAppointment.Location = strLocation Then _
             'objAppointment.Start = CDate(Format$(dteStartDate, "Short Date"))
          [COLOR=red]   objAppointment.Recipients.Add (Me.cbosupervisor)
              objAppointment.Send
[/COLOR]            objAppointment.Delete
              lngDeletedAppointements = lngDeletedAppointements + 1
             End If
Next
  MsgBox lngDeletedAppointements & " appointment(s) DELETED.", vbInformation, "DETETE Appointments"

 
End Sub
the red code is what I have tried with no success
thanks in advance

shane
 
Last edited:

Users who are viewing this thread

Back
Top Bottom