我从Primavera P6导出ms xml并在MS Project中导入它。我知道Primavera的关系数量。但我不确定是否所有关系都被导入MSP。任何人都可以告诉一个方法来找到MS项目中的关系数量。 请建议
答案 0 :(得分: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
答案 1 :(得分: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