Does anyone have some code or an idea on how to code to count an outlook calendar's appointments by category. I would like to count the green and yellow categorized items.
Does anyone have some code or an idea on how to code to count an outlook calendar's appointments by category. I would like to count the green and yellow categorized items.
Here's my code. It's retunring 0 so not sure it is evening counting what I want it to.
Sub CategoryFinder()
Dim Appt As Outlook.AppointmentItem
Dim cntYellow As Integer
Dim cntBlue As Integer
Dim Items As Outlook.Items
Dim Calendar As Outlook.Folder
Set Calendar = Session.GetDefaultFolder(olFolderCalendar)
Set Items = Calendar.Items
cntBlue = 0
For Each Appt In Items
On Error Resume Next
If Appt.End < Now() And Appt.End > Now() - 3 And Appt.Categories = "Assesment" Then
cntBlue = cntBlue + 1
End If
Next Appt
Debug.Print cntBlue
Set Appt = Nothing
End Sub
I did find a resolution to my issue
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks