Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
93 lines (43 sloc) 1.34 KB
title api_name ms.assetid
GroupCriteria.Count Property (Project)

GroupCriteria.Count Property (Project)

Gets the number of items in the GroupCriteria collection. Read-only Long.


expression. Count

expression A variable that represents a 'GroupCriteria' object.


The following example prompts the user for the name of a resource and then assigns that resource to tasks without any resources.

Sub AssignResource() 


 Dim T As Task ' Task object used in For Each loop 

 Dim R As Resource ' Resource object used in For Each loop 

 Dim Rname As String ' Resource name 

 Dim RID As Long ' Resource ID 


 RID = 0 

 RName = InputBox$("Enter the name of a resource: ") 


 For Each R in ActiveProject.Resources 

 If R.Name = RName Then 

 RID = R.ID 

 Exit For 

 End If 

 Next R 


 If RID <> 0 Then 

 ' Assign the resource to tasks without any resources. 

 For Each T In ActiveProject.Tasks 

 If T.Assignments.Count = 0 Then 

 T.Assignments.Add ResourceID:=RID 

 End If 

 Next T 


 MsgBox Prompt:=RName & " is not a resource in this project.", buttons:=vbExclamation 

 End If 


End Sub

See also

GroupCriteria Collection Object