Home › Forums › Discussion › Notify team members that prereqs for their tasks are complete? › Reply To: Notify team members that prereqs for their tasks are complete?
Option Explicit
Sub CheckPreds()
‘ This application cycles through a project and:
‘ Places data in the tasks Text15 to indicate the status of the task as done, underway or ready to start
‘ changes the font for the row to gray if the task is complete or if the task is inactive
‘ changes the font for the row to red if the task is on the critical path and is not complete or inactive
‘ Written by Mark Darby
‘ Updated on 8 May 2018
Dim proj As Project
Dim ts As Tasks ‘Active task selection
Dim tsk As Task
Dim tPred As Task
Dim tskCtr, ctr As Integer
Dim tskCount As Integer ‘ Count of the number of tasks in the project
Dim pCount As Integer ‘ Counts the number of predecessor tasks for any given task
Dim perComp As Double ‘ Percentage Complete for any given task
Dim pCompl As Integer ‘ Counts the number of complete tasks for any given task
Dim Ready As Boolean ‘ Flags the task as being ready to execute
Set proj = ActiveProject
OutlineShowAllTasks
FilterApply “All Tasks”
tskCount = ActiveProject.Tasks.Count
Debug.Print “Beginning Formatting Loop”
For tskCtr = 1 To tskCount
Set tsk = proj.Tasks(tskCtr)
SelectRow Row:=tskCtr, RowRelative:=False, Height:=0, Add:=False
Font Color:=pjBlack, Bold:=False
Font32Ex StrikeThrough:=False
If Not tsk.Active Then
Font Color:=pjGray, Bold:=False
Font32Ex StrikeThrough:=True
Else
If tsk.PercentComplete = “100” Then
Font Color:=pjGray, Bold:=False
Font32Ex StrikeThrough:=False
‘Else
‘ If tsk.Critical Then
‘ Font Color:=pjRed, Bold:=True
‘ Font32Ex StrikeThrough:=False
‘ End If ‘tsk.Cricital
End If ‘tsk.PercentageComplete = “100”
If tsk.Summary Then
Font Bold:=True
End If
End If ‘Not tsk.Active
Next tskCtr
Debug.Print “Beginning Task Statusing Loop”
For tskCtr = 1 To tskCount
Set tsk = proj.Tasks(tskCtr)
tsk.Text15 = “–”
If tsk Is Nothing Then
‘ do nothing on blank lines
Else
If tsk.Active Then
If Not tsk.PercentComplete = “100” Then
If Not tsk.Summary Then
If tsk.ActualStart <> “NA” Then
tsk.Text15 = “Underway”
Else
pCount = 0 ‘ total count
pCompl = 0 ‘ complete countFor Each tPred In tsk.PredecessorTasks
For Each tPred In tsk.PredecessorTasks
pCount = pCount + 1
If tPred.PercentComplete = “100” Then
pCompl = pCompl + 1
End If
Next tPred
If pCount = pCompl Then
tsk.Text15 = “Ready”
End If ‘PCount = pCompl
End If ‘tsk.ActualStart <> “NA”
End If ‘Not tsk.summary
End If ‘Not tsk.PercentComplete = “100”
Else
tsk.Text15 = “–”
End If ‘not tsk.active
End If ‘T is nothing
Next tskCtr
SelectTaskField Row:=1, Column:=”Name”, RowRelative:=False
Beep
End Sub
——————————–
BTW — I welcome any feedback on this….