VSTO 在 MS Project 中的分组中获取 "group by" 中的字段

VSTO Get the fields in "group by" on Groupings in MS Project

如何使用 VSTO vb.net.

获取 MS Project 中特定组的 "Group By" 中的所有字段

我试过这个:

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

但是我在第 2 个 For 循环中出错

谢谢, 吉尔伯特

GroupCriterion 对象的联机文档中似乎有一个执行此操作的示例。如果 link 更改,请在此处添加:

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