專案) (StartDriver.Suggestions 屬性
取得 PjTaskWarnings 值的組合,指出指定的工作是否有應該修正的潛在問題。 唯讀的 Long。
語法
expression。 Suggestions
表達 會傳回 StartDriver 物件的運算式。
註解
如果工作沒有建議,則 Suggestions 的值 為 0。 由於 pjTaskWarningsResourceBeyondMaxUnit 的值為 64, 而 pjTaskWarningsResourceOverallocated 的值為 128,如果 Suggestions 為 192,則工作會有兩個可能的問題。
注意事項
PjTaskWarnings列舉可以搭配Suggestions 屬性和Warnings屬性使用。
範例
在下列範例中,如果工作 2 的 Suggestions 屬性值為 128,則訊息方塊會顯示 資源已過度分派。 如果值是 68,顯示訊息方塊:
分派的資源大於最大的可用資源單位。
陰影任務會因為前置任務連結而提早完成。
Sub GetTaskSuggestions()
Dim suggestions As Long
Dim suggestionMsg As String
suggestions = ActiveProject.Tasks(2).StartDriver.Suggestions
suggestionMsg = CheckSuggestions(suggestions)
If Not suggestionMsg = "" Then MsgBox suggestionMsg
End Sub
Function CheckSuggestions(suggestions As Long) As String
Dim partial As Long
Dim suggestionResult As String
suggestionResult = ""
partial = suggestions Xor pjTaskWarningResourceBeyondMaxUnit
If partial < suggestions Then _
suggestionResult = suggestionResult & "The assignment is more than the maximum resource units available." & vbCrLf
partial = suggestions Xor pjTaskWarningResourceOverallocated
If partial < suggestions Then _
suggestionResult = suggestionResult & "The resource is overallocated." & vbCrLf
partial = suggestions Xor pjTaskWarningShadowFinishesEarlierDueToLink
If partial < suggestions Then _
suggestionResult = suggestionResult & "The shadow task finishes earlier because of a predecessor link." & vbCrLf
CheckSuggestions = suggestionResult
End Function
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。