|
![]() |
| Here's an example which illustrates many of Milestones Professional's OLE Automation methods. It builds a simple schedule, adds curtains, shades a task line and adds a duration SmartColumn. Try this example | |
| The Code: | |
|
Dim objproject, objmilestones, tasks, T As
Object SUBSTITUTE YOUR OWN FILE HERE 'Create the MS Project object 'Create the tasks object 'Start Milestones 'Set Schedule start and end dates 'Format the schedule 'first, make sure there are no columns 'set up one column on the left side of
the schedule objmilestones.SetSummaryBarDisplay 0 objmilestones.setcolumnproperty 1, "SmartColumn", "none" 'it will be outlined, so set the amount
to indent for each outline level 'make it left-justified 'add a column heading 'set up date headings 'we will have 22 tasks on each page 'add a curtain to shade the first 15
days of January 'Add titles using information in MS
Project file 'set up the symbology for summary tasks 'set up the symbology for non-summary
tasks 'set up symbology for critical tasks 'set up symbology for one-day events
(milestones) 'set up the legend 'loop through the list of MS Project
tasks and build For Each T In tasks objmilestones.settasklinegrid currentrow, 1, 7, 17 If T.Summary = True Then If T.Critical = True Then 'add text to the task name column If Format(T.start, "MM/DD/YY") = Format(T.Finish, "MM/DD/YY") Then 'single day milestones If T.Critical Then objmilestones.setsymbolproperty currentrow, 1, "FillColor", 6 Else 'add start+finish dates If T.Critical = True Then 'color critical
symbols red 'set the outline level 'set the font size 'display a message in the status bar 'keep the schedule open 'Maximize the Milestones window Exit Sub End Sub |
|
| To try this example: | |
| Click here to download a Zip file (MilestonesVBExample2.Zip) containing the above VB code. Note that you will need Microsoft Project and a Microsoft Project MPP file (any MPP file with tasks will work) to run this example. In the program, change the referenced MPP file name to a file name of one of the MPP files on your computer. | |
|


