Hi there,
I'm writing a function to search through a calendar to find any conflicting meeting times for the appointment recently recieved. Heres the code:
Private Function isConflict(appt As Outlook.Appoint mentItem) As Boolean
Dim strFind As String
Dim foundAppt As Outlook.Appoint mentItem
'string for a conflicting appointment
'calItem.start <= appt.start < calItem.end - appointment starts between an existing meeting
'calItem.start < appt.end <= calItem.end - appointment ends in an existing meeting
'calItem.start > appt.start and 'calItem.end < appt.end - appointment overlaps existing meeting
strFind = "([Start] <= '" & Format(appt.sta rt) & "'" & " and [End] > '" & Format(appt.sta rt) & "')" & _
"or ([Start] < '" & Format(appt.End ) & "'" & " and [End] >= '" & Format(appt.End ) & "')" & _
"or ([Start] >= '" & Format(appt.sta rt) & "'" & " and [End] <= '" & Format(appt.sta rt) & "')"
Set foundAppt = calItems.Find(s trFind)
'looks through the list of appointments for a conflict and skip the appointment to be scheduled
Do Until foundAppt = "Nothing" Or Not (appt.Subject = foundAppt.Subje ct)
Set foundAppt = calItems.FindNe xt()
Loop
End Function
appt is the appointment to be accepted/declined
calItem is a global variable initialized before the function call: Set calItems = ns.GetDefaultFo lder(olFolderCa lendar).Items
The error occurs at the Do Until loop. I'm not finished with the coding for this loop since I'm just trying to get past this error.
Any ideas?
Thanks,
Jason
I'm writing a function to search through a calendar to find any conflicting meeting times for the appointment recently recieved. Heres the code:
Private Function isConflict(appt As Outlook.Appoint mentItem) As Boolean
Dim strFind As String
Dim foundAppt As Outlook.Appoint mentItem
'string for a conflicting appointment
'calItem.start <= appt.start < calItem.end - appointment starts between an existing meeting
'calItem.start < appt.end <= calItem.end - appointment ends in an existing meeting
'calItem.start > appt.start and 'calItem.end < appt.end - appointment overlaps existing meeting
strFind = "([Start] <= '" & Format(appt.sta rt) & "'" & " and [End] > '" & Format(appt.sta rt) & "')" & _
"or ([Start] < '" & Format(appt.End ) & "'" & " and [End] >= '" & Format(appt.End ) & "')" & _
"or ([Start] >= '" & Format(appt.sta rt) & "'" & " and [End] <= '" & Format(appt.sta rt) & "')"
Set foundAppt = calItems.Find(s trFind)
'looks through the list of appointments for a conflict and skip the appointment to be scheduled
Do Until foundAppt = "Nothing" Or Not (appt.Subject = foundAppt.Subje ct)
Set foundAppt = calItems.FindNe xt()
Loop
End Function
appt is the appointment to be accepted/declined
calItem is a global variable initialized before the function call: Set calItems = ns.GetDefaultFo lder(olFolderCa lendar).Items
The error occurs at the Do Until loop. I'm not finished with the coding for this loop since I'm just trying to get past this error.
Any ideas?
Thanks,
Jason
Comment