VSTO在MS Project的分组中获取“分组依据”中的字段

时间:2018-03-15 03:04:53

标签: vsto ms-project

如何使用VSTO vb.net获取MS Project中特定组的“分组依据”中的所有字段。

我试过这个:

Dim tg As MsProj.Group

Dim strGrp As String = ""

For Each tg In project.TaskGroups
    strGrp = strGrp & "/" & vbCrLf & tg.Name
Next

MsgBox(project.TaskGroups("Group 6").GroupCriteria.Count)

Dim qwe As MSProject.GroupCriteria

For Each qwe In project.TaskGroups("Group 6").GroupCriteria
    MsgBox(qwe)
Next

但我在第二个For循环中出错

谢谢, 吉尔伯特

1 个答案:

答案 0 :(得分:1)

GroupCriterion对象的在线文档中似乎有一个例子。如果链接发生变化,请在此处添加:

Dim GC As GroupCriterion 
Dim Fields As String 

For Each GC In ActiveProject.TaskGroups("Priority Keeping Outline Structure").GroupCriteria 
 If GC.Ascending Then 
   Fields = Fields & GC.Index & ". " & GC.FieldName & " is sorted in ascending order." & vbCrLf 
 Else 
   Fields = Fields & GC.Index & ". " & GC.FieldName & " is sorted in descending order." & vbCrLf 
 End If 
Next GC 

MsgBox Fields