Deleting Appointment Automatically When Expired

O

Orion Cochrane

Is there a way for Outlook to automatically delete an appointment when the
system time is >=End of Appointment? I want a prompt before deleting.

TIA
 
K

Ken Slovak - [MVP - Outlook]

You would have to write code to do that, scanning your calendar folder on a
timer event or run manually from a macro or something like that.
 
K

Ken Slovak - [MVP - Outlook]

Very slightly modified from an example from the Outlook VBA Help on
Items.Restrict. Always use the Object Browser to look for examples and
sample code:

Public Sub ApptDateCheck()
Dim myNamespace As Outlook.NameSpace
Dim myAppts As Outlook.Items
Dim myItems As Outlook.Items
Dim myItem As Object
Dim i As Long
Dim DateStart As Date

DateStart = Date
Set myNamespace = Application.GetNamespace("MAPI")
Set myAppts = myNamespace.GetDefaultFolder(olFolderCalendar).Items
Set myItems = myAppts.Restrict("[End] < """ & DateStart & """")
For i = myItems.Count To 1 Step -1
Set myItem = myItems.Item(i)
If (myItem.Class = olAppointment) Then
myItem.Delete
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top