Răspuns Macro in MS Project

  • 27 September 2010 15:20
     
     

    How do I create a macro for more than one pre-desseour dependencies? in MS project 2010?

    Thanks,

    Zena

Semua Balasan

  • 27 September 2010 21:21
    Moderator
     
     

    Hi Zena,

    Create the dependencies one-by-one using the method:

    Task.TaskDependencies.Add (From, Type, Lag)

    I hope this helps,
    Hans


    My EPM blog: Projectopolis
  • 28 September 2010 10:50
    Moderator
     
     

    Further to Hans's response, the easiest way is to set up a suitable schedule, start recording a macro and then set the predecessor's you want. Once finished, stop the macro and review the code. 

     


    Alex Burton
    www.epmsource.com | Twitter
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
  • 28 September 2010 12:54
    Moderator
     
     

    Hi,

    Although this works in theory, very often it generates rather unusable code because it is fully concentrating on the selection of cells. OTOH nearly all code in VBA is written based on Task, Resources, Assignment objects and not on selections. To me, recording a macro is really the final ressort. Hans' suggestion is way better than what a macro recorder will generate:

    Sub Macro4()
    ' Macro Macro4
    ' Macro Recorded 28/09/10
        SelectTaskField Row:=-6, Column:="Name"
        SelectTaskField Row:=3, Column:="Name", Add:=True
        LinkTasks
        SelectTaskField Row:=-2, Column:="Name"
        SelectTaskField Row:=2, Column:="Name", Add:=True
        LinkTasks
    End Sub

    Maybe you will now agree with my description as "unusable"

    Greetings,

  • 28 September 2010 12:56
    Moderator
     
     

    Hi Zena,

    Since you unmarked Hans' post as answer could you specify more clearly what exactly you want?

    Greetings,

  • 29 September 2010 3:08
     
     

    I need to make the following value in the field of Predecessor work:

    10SS+2,11SS+2,30SS+2,
    10FF+2,11FF+2,30FF+2

    to have multiple dependencies to the same task like 10SS and 10FF.

    Thank you,

    Zena

  • 29 September 2010 5:53
    Moderator
     
     Jawab

    You can NOT have multiple dependencies between two tasks. What you are asking for is not possible with or without VBA.

     

    The closest you can come is by pasting links from one task start to the other, and from the task finish to another (look up "hammock task" for a description of this technique. I do not recommend that practice either as it is a bit fragile, I do not know that there are any VBA methods for the creation of those sorts of links either.

    Sorry, but you can not do what you want with Project.

    Think about some other way of achieving the same objective (perhaps a shared start milestone?)


    Jack Dahlgren blogs at:
    Project and Retrovention
    and rarely Twitter