StartDriver.Warnings property (Project)

Gets a combination of PjTaskWarnings values that indicate whether there are problems for a specified task. Read-only Long.

Syntax

expression. Warnings

expression An expression that returns a StartDriver object.

Remarks

If there are no warnings for a task, the value of Warnings is 0. Because the value of pjTaskWarningResourceBeyondMaxUnit is 64 and the value of pjTaskWarningResourceOverallocated is 128, if Warnings is 192, the task has both of the problems.

Note

The PjTaskWarnings enumeration can be used with both the Suggestions property and the Warnings property.

Example

In the following example, if the value of the Warnings property for task 5 is 128, the message box shows The resource is overallocated.. If the value is 68, the message box shows:

  • The assignment is more than the maximum resource units available.

  • The shadow task finishes earlier because of a predecessor link.

Sub GetTaskWarnings() 

 Dim warnings As Long 

 Dim warningMsg As String 

 

 warnings = ActiveProject.Tasks(5).StartDriver.Warnings 

 

 warningMsg = CheckWarnings(warnings) 

 

 If Not warningMsg = "" Then MsgBox warningMsg 

End Sub 

 

Function CheckWarnings(warnings As Long) As String 

 Dim partial As Long 

 Dim warningResult As String 

 

 warningResult = "" 

 partial = warnings Xor pjTaskWarningResourceBeyondMaxUnit 

 If partial < warnings Then _ 

 warningResult = warningResult & "The assignment is more than the maximum resource units available." & vbCrLf 

 

 partial = warnings Xor pjTaskWarningResourceOverallocated 

 If partial < warnings Then _ 

 warningResult = warningResult & "The resource is overallocated." & vbCrLf 

 

 partial = warnings Xor pjTaskWarningShadowFinishesEarlierDueToLink 

 If partial < warnings Then _ 

 warningResult = warningResult & "The shadow task finishes earlier because of a predecessor link." & vbCrLf 

 

 CheckWarnings = warningResult 

End Function

See also

StartDriver Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.