Recurrence Type of yearly evaluates to daily
I am writing VBA code to gather birthdays of clients from excel, and create birthday calendar appointment items in outlook, with a recurrence pattern of yearly. The code below works, with exception of creating an appointment item with a recurrence pattern of daily, instead of yearly. Stepping through each line, I noticed that the code changes the recurrence pattern from weekly to daily, rather than yearly, as expected. I am running Excel and Outlook 2016. Here is the code:
Code:
Sub Birthday2()
Dim objOutlook As Object
Dim objnSpace As Object
Dim objFolder As Object
Dim myOccurencePattern As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objnSpace = objOutlook.GetNamespace("MAPI")
Set myApt = objOutlook.CreateItem(1)
myApt.Subject = "Client Birthday"
myApt.Body = #1/19/2020#
myApt.Start = #1/19/2020#
myApt.AllDayEvent = True
myApt.ReminderMinutesBeforeStart = 10080
Set myOccurencePattern = myApt.GetRecurrencePattern
myOccurencePattern.RecurrenceType = olRecursYearly
myOccurencePattern.PatternStartDate = #1/19/2020#
myOccurencePattern.PatternEndDate = #1/19/2021#
myApt.Save
End Sub