我正在从 Primavera P6 导出 ms xml 并将其导入 MS Project。我知道 Primavera 中的关系数量。但我不确定是否所有的关系都被导入它 MSP。谁能告诉我在 MS Project 中查找关系数量的方法。请建议
问问题
504 次
2 回答
2
是的 - 如果您在项目上运行以下代码,它将产生一个对话框,说明项目中定义了多少依赖项:
Sub CountDependencies()
Dim i_RelationshipCount As Integer
Dim tsk As Task
Dim tsk_dep As TaskDependency
i_RelationshipCount = 0
For Each tsk In ActiveProject.Tasks
If tsk Is Nothing Then GoTo NextTask
For Each tsk_dep In tsk.TaskDependencies
'only count predecessors (otherwsie will count each realtionship twice)
If tsk_dep.To = tsk Then
i_RelationshipCount = i_RelationshipCount + 1
End If
Next tsk_dep
NextTask:
Next tsk
MsgBox i_RelationshipCount & " dependencies/relationships exist in this schedule."
End Sub
于 2014-02-21T13:03:03.883 回答
2
@AndrewEversight 的回答是完全正确的。FWIW:这是一个较小的例程,可以为您提供相同的结果:
Sub CountDependencies()
Dim i_RelationshipCount As Integer
Dim tsk As Task
i_RelationshipCount = 0
For Each tsk In ActiveProject.Tasks
If Not tsk Is Nothing Then
i_RelationshipCount = i_RelationshipCount + tsk.PredecessorTasks.Count
End If
Next tsk
MsgBox i_RelationshipCount & " dependencies/relationships exist in this schedule."
End Sub
于 2014-03-06T20:09:52.470 回答