none
MS Project Timeline, read it from VBA RRS feed

  • Question

  • Hi All,

    I am trying to automate an export from MS Project to Ms ProwerPoint.

    I love the timeline views, but I find them not so useful without a "graphical view" of the % complete.

    For this reason I would need to "read the % complete" from the timeline, and automate some "color coding" during the export...

    I have noticed that in MS project, in the Timeline view, if I hover my mouse pointer over a timeline bar, a pop-up message appear, telling me some additional information (Task Start, Task Finish, Duration, %Complete)... is it possible to read this information via VBA?

    many thanks all!

    Regards

    Ivan

    p.s. I would be happy to have your input/suggestion for alternative solutions

    Wednesday, April 27, 2016 4:25 AM

Answers

  • Hi Ivan,

    Now I understand (I think)

    The problem is that your original question did not address the actual problem.

    Identifying %complete of a task, once you identify the task itself, is not a problem.

    The problem is "how to identify the tasks on a timeline?"

    Well, curiously enough, there is no straightforward way to do that.

    The only workaround I can imagine is that you loop through the tasks with a for counter=1 to activeproject.tasks.count, then use the taskid in the TaskOnTimeline method to remove the task from the timeline and if the returning value is True, you know it was there, and you can re-insert it on the timeline.

    Not elegant but I can't find anything else.

    Hope it helps,

    • Marked as answer by Ivan Pironi Thursday, April 28, 2016 9:08 AM
    Thursday, April 28, 2016 8:41 AM
    Moderator

All replies

  • Hi,

    It is possible to read EVERYTHING via VBA. But beware, you do not read values from a view but from Project's data base, indepêndent of which view is active

    For instance, once you have identified a task (say you call it T) you have access to T.Start, T.Finish, T.Duration, T.PercentComplete, T.ActualWork...

    You can identify the selected task:

    Set T=Activeselection.tasks(1)

    What do you mean by automating "SOME" color coding?

    Greetings,

    Wednesday, April 27, 2016 8:32 AM
    Moderator
  • Thanks Jan,

    I have put together few timelines for different stakeholders (as you know, top guys wand a summary, which a gantt chart would not provide (at least in a same nice way)...

    because we provide ppt as status report, I was thinking to automate a copy and past of the timeline from MS Project to MS PowerPoint...

    My wish is to be able to loop through the tasks in the timeline, read the "% Complete" value and then, during the paste execution, I would change the "shape fill" to gradient (linear right), editing the Gradient Stops to the %Complete....

    in this way you would have a timeline where the color would provide you with the status update...

    any suggestions?

    Regards

    Ivan

    Thursday, April 28, 2016 12:50 AM
  • Hi,

    It is possible to read EVERYTHING via VBA. But beware, you do not read values from a view but from Project's data base, indepêndent of which view is active

    For instance, once you have identified a task (say you call it T) you have access to T.Start, T.Finish, T.Duration, T.PercentComplete, T.ActualWork...

    You can identify the selected task:

    Set T=Activeselection.tasks(1)

    What do you mean by automating "SOME" color coding?

    Greetings,

    I actually played around and I can definitely read "task info", but is there any way to "read" which task belongs to a specific timeline view???

    I have created specific timelines, which are easier to read... so I want to export same tasks.... (instead to go around the plan and insert a "flag" custom field... surely there must be a table storing which task is in which timeline... no???

    Thanks

    Regards

    ivan

    Thursday, April 28, 2016 6:48 AM
  • Hi Ivan,

    Now I understand (I think)

    The problem is that your original question did not address the actual problem.

    Identifying %complete of a task, once you identify the task itself, is not a problem.

    The problem is "how to identify the tasks on a timeline?"

    Well, curiously enough, there is no straightforward way to do that.

    The only workaround I can imagine is that you loop through the tasks with a for counter=1 to activeproject.tasks.count, then use the taskid in the TaskOnTimeline method to remove the task from the timeline and if the returning value is True, you know it was there, and you can re-insert it on the timeline.

    Not elegant but I can't find anything else.

    Hope it helps,

    • Marked as answer by Ivan Pironi Thursday, April 28, 2016 9:08 AM
    Thursday, April 28, 2016 8:41 AM
    Moderator
  • Thanks Jan,

    That would work... but as you said "not really elegant" :(

    will play around and let the forum know :)

    Regards

    Ivan

    Thursday, April 28, 2016 9:09 AM
  • Hi Jan,

    I have been played around the suggested solution... I am facing a problem with that:

    when I do the check if a task is removed or not from the timeline, I need to "undo" the action, because if I put back the task in the timeline, project place the the task "randomly", while in my timeline view I have place them in a specific way....

    I can only think of two option here:

    1) "undo" the remove task action (as far as I am concern, the undo does not work for VBA code -> any workaround here?

    2) "VBA sorting task in timeline" is there a function for this?

    thanks!

    Regards

    Ivan

    Wednesday, May 11, 2016 2:09 AM