将例外情况插入资源日历

Insert exceptions into Resource Calendar

我得到下面这段代码,它用 public 假期填充标准(基本)日历。任何人都可以直接将我指向 资源日历.

示例资源日历名称 =“Joe Bloggs”

这是我为基本日历工作的代码。

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

任何帮助将不胜感激。

使用资源的Calendar属性添加日历例外:

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