Set fldCalendar = nms.GetDefaultFolder(olFolderCalendar)
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(“tblContactsWithProjects”)
dteMonthAgo = DateAdd(“m”, -1, Date)
dteNextMonday = NextMondayTime()With rst
Do While Not .EOFCheck whether the last meeting date is older than a month ago.dteLastMeeting = Nz(![LastMeetingDate])
strProject = Nz(![CurrentProject])If dteLastMeeting < dteMonthAgo ThenCreate a new appointment item in the local Calendar folder.Set appt = fldCalendar.Items.Add
appt.Subject = strProject
appt.Start = dteNextMonday
appt.Duration = “60”
appt.ReminderSet = True
appt.Body = “Monthly project meeting”
appt.Close (olSave)
End If
.MoveNext
Loop
End WithMsgBox “Outlook project meeting appointments created “ErrorHandlerExit:
Exit FunctionErrorHandler:Outlook is not running; open Outlook with CreateObject.If Err.Number = 429 Then
Set appOutlook = CreateObject(“Outlook.Application”)
Resume Next
Else
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExit
End IfEnd FunctionPart II Writing VBA Code to Exchange Data between Office Components