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:
the red code is what I have tried with no success
thanks in advance
shane
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
thanks in advance
shane
Last edited: