Resource.Group 属性 (Project)

获取或设置资源所属的组。 可读/写 String 类型。

语法

表达式

表达 一个代表 Resource 对象的变量。

示例

下面的示例删除活动项目中属于用户所指定组的资源。

Sub DeleteResourcesInGroup() 
 
 Dim Entry As String ' The group specified by the user 
 Dim Deletions As Integer ' The number of deleted resources 
 Dim R As Resource ' The resource object used in loop 
 
 ' Prompt user for the name of a group. 
 Entry = InputBox$("Enter a group name:") 
 
 ' Cycle through the resources of the active project. 
 For Each R in ActiveProject.Resources 
 ' Delete a resource if its group name matches the user's request. 
 If R.Group = Entry Then 
 R.Delete 
 Deletions = Deletions + 1 
 End If 
 Next R 
 
 ' Display the number of resources that were deleted. 
 MsgBox(Deletions & " resources were deleted.") 
 
End Sub

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。