Example 1 - Create, print, and save a file

 

This program starts Milestones Professional, creates a new schedule, puts a symbol on task row 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/2023", "6/30/2023")

            'Add task 1 (single milestone)

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

            .AddSymbol(1, "4/14/2023", 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/2023", 1, 1, 2)

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

            'Add task 3

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

            .AddTaskUsingDuration(3, "4/15/2023", 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

 

 

 

 

 

 

In this example the .Save method will cause a File Save As dialog box to appear because there is no filename associated with the Milestones object.  visit our programmer's page for more examples

 

 

 


 

 

Related Topics

  1. AddSymbol
  2. PutCell
  3. SetStartAndEndDates

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

To effectively program with this interface, it's important to learn all about Milestones Professional.  Learn about Milestones.

Milestones Professional 2025 Automation Methods and Properties.  © Copyright 2000-2025, KIDASA Software, Inc. All rights reserved.