Archive for the ‘VBA’ Category

Outlook VBA – remove reminders

Friday, August 27th, 2010

I synchronize my Windows Mobile Device with my corporate-exchange account. This way my calendar stays nicely up to date and gives me reminders for the tasks I have to do.

However I find it rather a hassle that I receive reminders for certain activities like holidays. Therefore I have written a small macro that disables the reminders for all future calendar entries with a certain subject.

Private Sub RemoveReminders(sProject As String)
Dim fldMailbox As MAPIFolder
Dim fldCalendar As MAPIFolder
 
Dim objItem As AppointmentItem
Dim iCntr As Integer
iCntr = 0
 
Set fldMailbox = Session.Folders(sMailboxName)
Set fldCalendar = fldMailbox.Folders("Calendar")
Set mcolCalItems = fldCalendar.Items
 
For Each objItem In mcolCalItems
If objItem.start > Now() Then
If objItem.ReminderSet = True Then
    If InStr(objItem.Body, sProject) > 0 Then
    iCntr = iCntr + 1
With objItem
.ReminderSet = False
.Save
End With
 
objItem.Save
End If
End If
End If
Next
 
MsgBox "Modified " & iCntr & " calendar entries"
End Sub
 
Public Sub RemoveHolidayReminders()
RemoveReminders ("Holiday")
End Sub