0

we are just starting to investigate MS Project Online - Enterprise. I use a couple of VBA scripts in the standard version of MS Project, just can't figure out if its possible to add exceptions using VBA into the Enterprise Calendar. I want to populate at least 10 years worth of public holidays and would rather not manually doing it.

thanks in advance

My existing scripts for adding exceptions are below:

Sub Create_Resource_Exceptions() 'used for resources

Dim e As Exception
Dim cal As Calendar
Dim CalName As String

CalName = ActiveProject.Calendar.name 

ActiveProject.Resources("TempPublicHolidays").Calendar.Exceptions.Add Type:=1, Start:="1/01/2020", Finish:="1/01/2020", name:="New Year's Day"
'copy above to insert more public holidays
End Sub

and

Sub Create_New_Exceptions() ' Used for the base calendar

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 Year's Day" ActiveProject.BaseCalendars(CalName).Exceptions.Add Type:=1, 
End Sub
Joe Bloggs
  • 43
  • 6
  • Joe, I'm a bit confused as to why you have two macros. The first does NOT add resource calendar exceptions, it simply duplicates the exceptions for the Project calendar which by default IS the base calendar for resources. But to address your issue, let me consult with a colleague who knows more about Project Online enterprise calendars (I only use Project desktop) and I'll get back to you. – john-project Nov 29 '22 at 15:51
  • Hi John, thanks for you time. TempPublicHolidays in the first code block is the resource (sorry I should have edited it with a name). I can assure you it does create exceptions for a resource. If you create a resource called "Joe Bloggs" and change that first code block to use ("Joe Bloggs") instead of ("TempPublicHolidays") and run that code, it will create the exception. – Joe Bloggs Dec 02 '22 at 07:02
  • 1
    Joe, Yeah that makes more sense. On your main question I did hear back from my colleague. He ran some tests and said the code will not run for editing the Enterprise Standard calendar when connected to Project Online. There may be some trick to make it work but unfortunately I don't know what this is. Sorry – john-project Dec 02 '22 at 20:31
  • Thanks anyway @john-project, I appreciate your efforts. – Joe Bloggs Jan 25 '23 at 01:45

0 Answers0