KIDASA Software, Inc. Website   

HOME   |   BUY   |   DOWNLOAD   |  PRODUCTS   |    NEWS   |   SUPPORT   |   CONTACT   |   EXAMPLES   |   SEARCH

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

    
      Visual Basic Example #1

  


Create a master schedule from 3 schedules and create a PDF file.
This example opens 3 previously created schedules (A, B and C), and checks their start and finish dates.  Next, it creates a new schedule and  adds the three schedules, one by one to the new schedule, building a master schedule.  Finally, it generates a PDF file from the master schedule.
    
The Code: 
     
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 Date

Set 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
 


 
Click here to visit the Milestones Professional Programmer's page.
 
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  © Copyright KIDASA Software, Inc. 2008 All Rights Reserved   1114 Lost Creek Blvd., Suite 300 Austin, TX  78746  512-328-0167   sales@kidasa.com