Steve64
06-12-2012, 04:27 AM
Im using the code below (Which is working fine) in access to open MS Project "GanttDept.mpp" file, the file has a resource list, Im trying to add non-working days to the resource calendars of the resources IE add holidays.
As you can see from the code I can add resource exceptions if I hard code it, how can I change this line : aProg.Resources("A Person").Calendar.Exceptions.Add Type:=1, Start:="12/06/2012", Finish:="15/06/2012", Name:="Leave"
So it will get; A Person, Start; Finish and Name from either a table; form or query, Iv tried [forms]![frmName]![text0]
I want the exceptions added this way when the project file opens as I won’t be monitoring the holidays, holidays are added to the access database already.
Public Function OpnMSProjectDept()
Dim appProj As Object
Dim aProg As Object
Set appProj = CreateObject("Msproject.Application")
appProj.fileopen "\\gbs2040\LocalDatabases$\TechnicalRequests\ExcelChart\GanttDept.mpp", readonly:=True
Set aProg = appProj.ActiveProject
appProj.Visible = True
aProg.Resources("A Person").Calendar.Exceptions.Add Type:=1, Start:="12/06/2012", Finish:="15/06/2012", Name:="Leave"
Set appProj = Nothing
Set aProg = Nothing
End Function
Thanks
As you can see from the code I can add resource exceptions if I hard code it, how can I change this line : aProg.Resources("A Person").Calendar.Exceptions.Add Type:=1, Start:="12/06/2012", Finish:="15/06/2012", Name:="Leave"
So it will get; A Person, Start; Finish and Name from either a table; form or query, Iv tried [forms]![frmName]![text0]
I want the exceptions added this way when the project file opens as I won’t be monitoring the holidays, holidays are added to the access database already.
Public Function OpnMSProjectDept()
Dim appProj As Object
Dim aProg As Object
Set appProj = CreateObject("Msproject.Application")
appProj.fileopen "\\gbs2040\LocalDatabases$\TechnicalRequests\ExcelChart\GanttDept.mpp", readonly:=True
Set aProg = appProj.ActiveProject
appProj.Visible = True
aProg.Resources("A Person").Calendar.Exceptions.Add Type:=1, Start:="12/06/2012", Finish:="15/06/2012", Name:="Leave"
Set appProj = Nothing
Set aProg = Nothing
End Function
Thanks