Example 9 - A Milestones automation sampler

 

This example illustrates various methods and properties required to build this example:

  1.  

 

 

 

 Sub MilestonesSampler()

        Dim strtemp As String, ncounter As Integer

        Dim crlfstring As String
        crlfstring = Chr(13) + Chr(10) + Chr(13) + Chr(10)
        With milestonesobject
            .use20columns()
            .allcolorsarergb()
            .applycolortheme("autumn", "false", "true")
            .setmiscproperty("splitduration", 1)
            For ncounter = 1 To 20
                .setcolumnproperty(ncounter, "width", 0.0)
                .setcolumnproperty(ncounter, "smartcolumn", "none")
            Next
            .setsymbolfilltostatus("off")
            .setconnectorfilltostatus("off")

            'set up a column, 2 inches wide
            .SetColumnWidth(1, 2.0)

            'set number of lines per page to 11
            .setlinesperpage(11)

            'no legend
            .setlegendheight(0.0)

            setupacooltoolbox()

            .settoolboxhorizontalconnectorproperty(2, "Type", 62)


            'Add tasks and symbols to the schedule

            For ncounter = 1 To 11
                Dim startsymboltype As Integer
                startsymboltype = ncounter * 2 + 1
                strtemp = "This is Task Row " + CStr(ncounter)
                .PutCell(ncounter, 1, strtemp)
                strtemp = CStr(ncounter + 1) + "/12/2023"
                .AddTaskUsingDuration(ncounter, strtemp, startsymboltype, ncounter, 0, startsymboltype + 1, 33 + ncounter, "day")
                Dim percentcomplete As Integer
                percentcomplete = ncounter * 10
                If percentcomplete > 100 Then percentcomplete = 100
                .SetSymbolProperty(ncounter, 1, "Percent1Override", percentcomplete)
            Next ncounter

            'Add a symbol
            .SetSymbolProperty(5, 1, "SymbolNotes", "A sample symbol note" + crlfstring + "the    second line")
            .SetSymbolProperty(5, 1, "SymbolNoteDisplay", 1)
            .SetSymbolProperty(5, 1, "SymbolNoteFont", "Bodoni")
            .SetSymbolProperty(5, 1, "SymbolNoteFontSize", 8)
            .SetSymbolProperty(5, 1, "SymbolNoteBackgroundColor", RGB(255, 200, 200))
            .SetSymbolProperty(5, 1, "SymbolNoteBackgroundColorTarget", RGB(255, 0, 0))
            .SetSymbolProperty(5, 1, "SymbolNoteFrameColor", RGB(255, 255, 0))
            .SetSymbolProperty(5, 1, "SymbolNoteShadowColor", RGB(0, 0, 255))
            .SetSymbolProperty(5, 1, "SymbolNoteConnectorColor", RGB(150, 150, 150))
            .SetSymbolProperty(5, 1, "SymbolNoteFrameDisplay", 0)
            .SetSymbolProperty(5, 1, "SymbolNoteShadowDisplay", 1)
            .SetSymbolProperty(5, 1, "SymbolNoteConnectCenter", 1)
            .SetSymbolProperty(5, 1, "SymbolNoteSpecialEffects", 7)
            .SetSymbolProperty(5, 1, "SymbolNoteConnectorType", 7)
            .SetSymbolProperty(5, 1, "SymbolNoteFontJustification", 1)
            .SetSymbolProperty(5, 1, "SymbolNoteFontBold", 1)
            .SetSymbolProperty(5, 1, "SymbolNoteFontItalic", 1)
            .SetSymbolProperty(5, 1, "SymbolNoteFontUnderline", 1)
            .SetSymbolProperty(5, 1, "SymbolNoteXOffset", -30)
            .SetSymbolProperty(5, 1, "SymbolNoteYOffset", -20)


            'Format task column
            .SetColumnWidth(1, 2.0#)
            .SetColumnProperty(1, "SmartColumn", "text")
            .SetColumnProperty(1, "TextAlign", 0)  'Left Justified
            .SetColumnProperty(1, "ColumnHeadingLine1", "Tasks")  'Column Heading 
            .SetColumnProperty(1, "ColumnHeadingLine2", "")
            .SetColumnProperty(1, "Indent", 0.1)

            'Add a Duration column
            .SetColumnWidth(2, 0.7)
            .SetColumnProperty(2, "SmartColumn", "duration")
            .SetColumnProperty(2, "TextAlign", 2)
            .SetColumnProperty(2, "ColumnHeadingLine1", "Days")  'Column Heading 
            .SetColumnProperty(2, "ColumnHeadingLine2", "")
            .SetColumnProperty("DurationType", 0) ' global property (0=days)


            'Add a % Complete column
            .SetColumnWidth(3, 0.7)
            .SetColumnProperty(3, "SmartColumn", "PercentComplete")
            .SetColumnProperty(3, "TextAlign", 2)
            .SetColumnProperty(3, "ColumnHeadingLine1", "%")  'Column Heading 
            .SetColumnProperty(3, "ColumnHeadingLine2", "Comp")

            'set the start and end dates
            .SetStartAndEndDates("01/01/2023", "03/31/2024")

           

            'set up curtains
            .setmiscproperty("ShowCurtainsOverHorzGridlines", 1)

            .AddCurtain("1/1/2023", "1/15/2023") 'Curtain 1
            ' name this curtain...will be set task by task
            .SetCurtainProperties(1, "1/1/2023", "1/31/2023", RGB(102, 204, 255), RGB(0, 0, 255), 7, 1, "January2023")

            'white pattern color, teal background color, horizontal stripes:
            .AddCurtain("3/1/2023", "3/15/2023") 'Curtain 2
            .SetCurtainProperties(2, "3/1/2023", "3/15/2023", RGB(255, 255, 255), RGB(0, 128, 128), 2, 0)

            'white pattern color, blue background color, diamond pattern:
            .AddCurtain("10/1/2023", "11/15/2023") 'Curtain 3
            .SetCurtainProperties(3, "10/1/2023", "11/15/2023", RGB(255, 255, 255), RGB(0, 0, 128), 9, 0)

            .AddCurtain("1/1/2024", "1/15/2024") 'Curtain 4
            .SetCurtainProperties(4, "2/1/2024", "2/28/2024", RGB(0, 128, 0), RGB(204, 255, 255), 17, 1, "Feb2024")

            'set task line curtain labelled january2017 on task row 1 and task row 4
            .settasklinecurtain(1, 1, "January2023")
            .settasklinecurtain(4, 1, "January2023")

            'set task line curtain labelled april2020 on task row 1 and task row 5

            .settasklinecurtain(1, 2, "Feb2024")  ' second parameter (2) indicates this is the second curtain on row 1
            .settasklinecurtain(5, 1, "Feb2024")

            .settitle1("A Milestones Automation Sampler")
            .settitle2("Many Methods Shown")
            .setfontsize(3, 28)

        End With

    End Sub

 

 

 

 

Related Topics

  1. SetTaskLineCurtain
  2. AddCurtain
  3. SetCurtainDisplayOptions
  4. SetCurtainProperties
  5. SetColumnProperty
  6. AddTaskUsingDuration

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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.