Insert exceptions into Resource Calendar

I got this code below which populates the Standard (Base) calendar with public holidays. Can anyone point my in the right direct to do the same onto a resource calendar.

Example resource calendar name = "Joe Bloggs"

here is the code I've got working for the base calendar.

Sub Create_New_Exceptions()
    
    Dim e           As Exception
    Dim cal         As Calendar
    Dim CalName     As String
    
    CalName = ActiveProject.Calendar.Name
    
    ActiveProject.BaseCalendars(CalName).Exceptions.Add Type:=1, Start:="1/01/2020", Finish:="1/01/2020", Name:="New        's Day"
    'copy above to insert more public holidays
    
End Sub

Any help will be appreciated.


Solution 1:

Use the Calendar property of the Resource to add calendar exceptions:

ActiveProject.Resources("Joe Bloggs").Calendar.Exceptions.Add Type:=1, Start:="1/01/2020", Finish:="1/01/2020", Name:="New        's Day"