共用方式為


(Project) 的 Resource.Group 屬性

會取得或設定資源所屬的群組。 可讀寫的 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 支援與意見反應