Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Latest commit

 

History

History
60 lines (41 loc) · 1.21 KB

period-count-property-project.md

File metadata and controls

60 lines (41 loc) · 1.21 KB
title ms.prod api_name ms.assetid ms.date
Period.Count Property (Project)
project-server
Project.Period.Count
8b1caae6-2ae1-12c4-1f94-b52dcececd45
06/08/2017

Period.Count Property (Project)

Gets the number of days in the Period object. Read-only Integer.

Syntax

expression. Count

expression A variable that represents a Period object.

Example

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 
 Else 
 MsgBox Prompt:=RName &; " is not a resource in this project.", buttons:=vbExclamation 
 End If 
 
End Sub