Sub Main()
Dim objmilestones As Object
Dim objmilestones1 As Object
Dim objmilestones2 As Object
Dim objmilestones3 As Object
Dim MasterScheduleList As String
Dim StartDate As String
Dim StartDate1 As Date
Dim StartDate2 As Date
Dim StartDate3 As Date
Dim EndDate As String
Dim EndDate1 As Date
Dim EndDate2 As Date
Dim EndDate3 As DateSet
objmilestones1 = GetObject("C:\test\A.mla")
With objmilestones1
.Activate
StartDate1 = .GetStartDate(1)
EndDate1 = .GetEndDate(1)
.Close "nosave"
End With
Set objmilestones2 = GetObject("C:\test\B.mla")
With objmilestones2
.Activate
StartDate2 = .GetStartDate(1)
EndDate2 = .GetEndDate(1)
.Close "nosave"
End With
Set objmilestones3 = GetObject("C:\test\C.mla")
With objmilestones3
.Activate
StartDate3 = .GetStartDate(1)
EndDate3 = .GetEndDate(1)
.Close "nosave"
End With
If StartDate2 < StartDate1 then StartDate1=StartDate2
If StartDate3 <= StartDate1 And StartDate3 Then StartDate1 = StartDate3
If EndDate2 >EndDate1 Then EndDate1 = EndDate2
If EndDate3 >EndDate1 Then EndDate1 = EndDate3
'All of this is required to make sure that your master schedule will
include the date ranges of all subschedules.
Set objmilestones = CreateObject("Milestones")
With objmilestones
.Activate
.SetStartAndEndDates StartDate1, EndDate1
.AddToMasterScheduleList "C:\test\C.mla" 'Add all
subschedules.
.AddToMasterScheduleList "C:\test\B.mla"
.AddToMasterScheduleList "C:\test\A.mla"
.UpdateMasterSchedule 'You must update for
these schedules to appear in the master schedule
.SavePDF "C:\test\MasterSchedule.pdf" 'SavePDF for
picture perfect presentation.
.Refresh
.KeepScheduleOpen
End With
End Sub