Multi-line timeline through VBA

Started by Noisy Cricket, October 06, 2015, 06:51:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Noisy Cricket

Hi all,

Further my ever expanding Visio endeavours, I've now set my mind to automated creation of a timeline which contains multiple intervals and milestones on individual vertical levels.

I've found:
http://blogs.msdn.com/b/chcast/archive/2004/11/12/256599.aspx
and
http://blogs.msdn.com/b/chcast/archive/2004/11/17/259191.aspx

These seem to point in the right direction as per code below for timeline and milestone

Public Sub TimelineTest()

   

    Dim theTimeline As Shape

    Dim theMilestone As Shape



    Application.AlertResponse = 1



    Set theTimeline = Application.ActiveWindow.Page.Drop(Application.Documents.Item("TIMELN_M.VSS").Masters.ItemU("Block timeline"), 5.610236, 5.511811)

       

    theTimeline.CellsU("User.visBeginDate").FormulaU =Application.ConvertResult("1/1/2004", VisUnitCodes.visDate, VisUnitCodes.visInches)

       

    theTimeline.CellsU("User.visEndDate").FormulaU =Application.ConvertResult("12/31/2004", VisUnitCodes.visDate, VisUnitCodes.visInches)

   

    ' Refresh the timeline, here it is...

    Application.Addons("ts").Run "/cmd=3"

   

    Set theMilestone = Application.ActiveWindow.Page.Drop(Application.Documents.Item("TIMELN_M.VSS").Masters.ItemU("Line milestone"),5.610236, 5.511811)

   

    theMilestone.CellsU("User.visMilestoneDate").FormulaU =Application.ConvertResult("7/1/2004", VisUnitCodes.visDate, VisUnitCodes.visInches)
    Application.AlertResponse = 0

   

End Sub


I'm getting a timeline and seem to be able to add intervals and milestones but for some reason, I can't get the title to update nor update the locpiny to be a multiple of the shape's height (i.e. "=height*5) to subsequently stagger the intervals.

Can anyone help me out!?