I am working on various programmes developed by third party.
Quite often the calendars have incorrect exceptions.
How can I remove all exceptions at once without checking whether there are any, and them create new onces?
So far:
TO DELETE AN EXCEPTION:
Sub Delete_Exception ()
Dim cal As Calendar
Dim CalName As String
CalName = ActiveProject.Calendar.Name
ActiveProject.BaseCalendars(calName).Exceptions(1).Delete
End Sub
TO CREATE EXCEPTION:
Sub Create_Exception ()
Dim cal As Calendar
Dim CalName As String
CalName = ActiveProject.Calendar.Name
ActiveProject.BaseCalendars(CalName).Exceptions.Add Type:=1, Start:="22/03/2011", Finish:="22/04/2011", Name:="2013 Good Friday"
End Sub
The creation code works fine.
I have trouble with the deleting as it only works with one line.
how can I make it:
- first detect whether there is any exception in place
- secondly loop it in order to delete all data
Anybody, please?
Quite often the calendars have incorrect exceptions.
How can I remove all exceptions at once without checking whether there are any, and them create new onces?
So far:
TO DELETE AN EXCEPTION:
Sub Delete_Exception ()
Dim cal As Calendar
Dim CalName As String
CalName = ActiveProject.Calendar.Name
ActiveProject.BaseCalendars(calName).Exceptions(1).Delete
End Sub
TO CREATE EXCEPTION:
Sub Create_Exception ()
Dim cal As Calendar
Dim CalName As String
CalName = ActiveProject.Calendar.Name
ActiveProject.BaseCalendars(CalName).Exceptions.Add Type:=1, Start:="22/03/2011", Finish:="22/04/2011", Name:="2013 Good Friday"
End Sub
The creation code works fine.
I have trouble with the deleting as it only works with one line.
how can I make it:
- first detect whether there is any exception in place
- secondly loop it in order to delete all data
Anybody, please?