如何使用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循环中出错
谢谢, 吉尔伯特
答案 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