I'm trying to get this code I found online that I modified to get my recipients.count value so I can add it into a if statement that will determine if there is one, two declines and change the calendar to a specific color based on the recipients declined count. I get the Compile Error: Can't assign to read-only property. If you can provide some help with this issue as I'm new to vba scripting and would like to get this to work. I'm using windows 10 with outlook 2016.
Sub CheckDeclines(oRequest As MeetingItem)
' only check declines
If oRequest.MessageClass <> "IPM.Schedule.Meeting.Resp.Neg" Then
Exit Sub
End If
Dim oAppt As AppointmentItem
Set oAppt = oRequest.GetAssociatedAppointment(True)
Dim myAttendees As Integer
Dim objAttendees As Outlook.recipients
Set objAttendees = oAppt.recipients
For x = 1 To objAttendees.Count
If objAttendees(x).Type = olRequired Then
oAppt.Categories = "Declined;"
objAttendees.Count = myAttendees
End If
Next
If myAttendees = 1 Then
oAppt.Categories = "Declined;"
oAppt.Categories = "Yellow Category"
Else
If myAttendees = 2 Then
oAppt.Categories = "Declined;"
oAppt.Categories = "Orange Category"
Else
oAppt.Categories = "Declined;"
oAppt.Categories = "Red Category"
End If
End If
oAppt.Display
End Sub
Aucun commentaire:
Enregistrer un commentaire