Example 1 - Create, Print, Save a File

Summary:

This program starts Milestones Professional, creates a new schedule, puts a symbol on task rowA horizontal row on the schedule, usually containing the name of a project step and important milestone dates for that step. 1, prints it, saves it, and then closes it.

Example Code:

 

Public Sub Example1()

        Dim objmilestones As Object

        Dim nFileHandleVariant As VariantType, nFileHandleInt As Integer

        objmilestones = CreateObject("Milestones")

        With objmilestones

            'Start Milestones

            .Activate()

            'Set Schedule start and end dates

            .SetStartAndEndDates("3/1/2016", "6/30/2016")

            'Add task 1 (single milestone)

            .PutCell(1, 1, "Task 1")

            .AddSymbol(1, "4/14/2016", 2)

            'Add task 2 (by adding two symbols)

            .PutCell(2, 1, "Task 2")

            'first symbol is connected to second on this task

            .AddSymbol(2, "4/20/2016", 1, 1, 2)

            .AddSymbol(2, "6/15/2016", 2)

            'Add task 3

            .PutCell(3, 1, "Task 3")

            .AddTaskUsingDuration(3, "4/15/2016", 1, 1, 0, 2, 15, "Days")

            'Save the schedule

            nFileHandleVariant = 0

            nFileHandleVariant = .Save

            nFileHandleInt = nFileHandleVariant

            If (nFileHandleInt = 0) Then

                MsgBox("File Save Failed")

            End If

            'Print the schedule

            .print()

            'Refresh the Milestones schedule

            .Refresh()

            'Keep the schedule open

            .KeepScheduleOpen()

        End With

    End Sub

 

Notes:

 

Milestones Professional 2019 Automation Methods and Properties.  © Copyright 2018, KIDASA Software, Inc. All rights reserved.