ResourceGroups2 物件(專案)ResourceGroups2 object (Project)

代表所有的群組階層可以維護其中資源為基礎的群組定義。Represents all of the resource-based group definitions, where group hierarchy can be maintained. ResourceGroups2Group2 物件的集合。ResourceGroups2 is a collection of Group2 objects.

範例Example

使用 ResourceGroups2 集合Using the ResourceGroups2 Collection

使用 ResourceGroups2 屬性可傳回 ResourceGroups2 集合。Use the ResourceGroups2 property to return a ResourceGroups2 collection. 下列範例會列出使用中專案中的所有資源群組的名稱。The following example lists the names of all the resource groups in the active project.

Dim rg2 As Group2  
Dim rGroups2 As String  
  
For Each rg2 in ActiveProject.ResourceGroups2  
    rGroups2 = rGroups2 & rg2.Name & vbCrLf  
Next rg2  
  
MsgBox rGroups2

使用 Add 方法將 Group2 物件新增到 ResourceGroups2 集合。Use the Add method to add a Group2 object to the ResourceGroups2 collection. 下列範例會建立新的群組該群組的資源由其標準工資率,然後修改準則使資源以遞減順序排序。The following example creates a new group that groups resources by their standard rate and then modifies the criterion so that the resources are sorted in descending order.

ActiveProject.ResourceGroups2.Add "Resources by Rate", "Standard Rate"  
ActiveProject.ResourceGroups2("Resources by Rate").GroupCriteria(1).Ascending = False

方法Methods

名稱Name
AddAdd
CopyCopy

屬性Properties

名稱Name
ApplicationApplication
CountCount
項目Item
ParentParent

另請參閱See also

Project 物件模型Project Object Model

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.