Access.2007.VBA.Bibl..

(John Hannent) #1
Set reference to (or create) contact’s calendar:

On Error Resume Next
Set fldTopCalendar = _
appOutlook.Session.GetDefaultFolder(olFolderCalendar)
Set fldContactCalendar = _
fldTopCalendar.Folders(strEmployeeName)
If fldContactCalendar Is Nothing Then
Set fldContactCalendar = _
fldTopCalendar.Folders.Add(strEmployeeName)
End If

Set reference to (or create) supervisor’s calendar:

Set fldSupervisorCalendar = _
fldTopCalendar.Folders(strSupervisorName)
If fldSupervisorCalendar Is Nothing Then
Set fldSupervisorCalendar = _
fldTopCalendar.Folders.Add(strSupervisorName)
End If

On Error GoTo ErrorHandler

Create appointment in contact’s calendar:

Set appt = fldContactCalendar.Items.Add
With appt
.Start = CStr(dteNextReviewDate) & “ 10:00 AM”
.AllDayEvent = False
.Location = “Small Conference Room”
.ReminderMinutesBeforeStart = 30
.ReminderSet = True
.ReminderPlaySound = True
.Subject = “Review with “ & strSupervisorName
.Close (olSave)
End With

Create appointment in supervisor’s calendar:

Set appt = fldSupervisorCalendar.Items.Add
With appt
.Start = CStr(dteNextReviewDate) & “ 10:00 AM”
.AllDayEvent = False
.Location = “Small Conference Room”
.ReminderMinutesBeforeStart = 30
.ReminderSet = True
.ReminderPlaySound = True
.Subject = strEmployeeName & “ review”
.Close olSave
End With

Part I The Office Components and What They Do Best

Free download pdf