Closing open ends in MS Project and FS-links with negat

Member for

24 years 7 months

Here a a macro that will link two selected tasks S2S and F2F by adding a Finish milestone between them. It will add the S2S lag if they are overlapped.



Sub LinkS2SF2F()

’**********************************8

’* This macro will connect selected tasks with Start-to-Start & F2F ties

’*

’* Ray Messinger 8-Aug-08

’*

’**********************************



Dim tt As Task

Dim tt1 As Task

Dim tt2 As Task

Dim myProj As Project



minperday = ActiveProject.HoursPerDay * 60



Set myProj = ActiveProject

Set myTasks = ActiveSelection.Tasks

fName = ActiveProject.name



If myTasks.Count <> 2 Then

MsgBox "You must have two tasks selected for this macro to work"

Exit Sub

End If



Dim TaskIDs(2)

For Each tt In myTasks

tcnt = tcnt + 1

TaskIDs(tcnt) = tt.ID

Next



’--- Add Start to Start ---

For t = 1 To tcnt - 1



Set tt1 = myProj.Tasks(TaskIDs(t))

Set tt2 = myProj.Tasks(TaskIDs(t + 1))



Sdate1 = tt1.Start

Sdate2 = tt2.Start

DDiff = Application.DateDifference(Sdate1, Sdate2)

dlagday = Int(DDiff / minperday)

dlagday = dlagday & "d"



tt2.TaskDependencies.Add tt1, pjStartToStart, dlagday ’add predecessor to task2

tt2.ConstraintType = pjASAP



Next



’-- Add Finish Milestone ----

tid = tt1.ID

NewID = tid + 1

ActiveProject.Tasks.Add name:="The New Task", Before:=NewID ’insert after



Set NewTask = myProj.Tasks(NewID)



With NewTask

.name = tt1.name & " Finish"

.Calendar = tCalName

.Duration = 0

End With



NewTask.TaskDependencies.Add tt1, pjFinishToStart, 0

tt2.TaskDependencies.Add NewTask, pjFinishToFinish, 0





Beep

End Sub

Member for

19 years 11 months

Your option 2) is best, regardless of the downside considerations that you mention, which I think are not very significant.

Options 1) and 4) are the worst.

I don’t understand option 3).

I notice that you favour option 4) without mentioning the arguments against it.



Before software, project planning was possible.

Then early software made critical path method networking possible even though functionality was limited to FS links with positive or zero lag only.



It is still possible, and recommended good practice, to use only FS links with positive or zero lag.



Start with some rules and stick to them, and don’t just bend or break them for convenience.



Every Task should have at least one FS predecessor and one FS Successor.

When it seems necessary to use other kinds of links and negative lag, it is really a sure indicator that the Tasks need to be chopped up into smaller pieces.



Lots of Milestones can be very useful as predecessors or successors for Tasks which don’t appear otherwise to have one.



Other links can be applied, as extras, after every Task gets at least one FS predecessor and one FS Successor.



FS links are a good representation of reality. Every Task cannot start until some other Task is finished.



FS with negative lag is a joke, and evil as can be. The signal for the start of a Task B goes off in the future and it is impossible to know when to start Task B, ie when you are x Days before the finish of Task A. It is like jumping off the starting blocks at the swimming pool 0.5 seconds before the gun goes off.