Skip to content

Latest commit

 

History

History
98 lines (59 loc) · 2.11 KB

Project.Month.md

File metadata and controls

98 lines (59 loc) · 2.11 KB
title ms.service api_name ms.assetid ms.date ms.localizationpriority
Month object (Project)
project-server
Project.Month
5ee32f12-72aa-fa16-ead2-97949005cd7c
06/08/2017
medium

Month object (Project)

Represents a month in a year. The Month object is a member of the Months collection.

Example

Using the Month Object

Use Months (Index ), whereIndex is the month index number, month name, or PjMonth constant, to return a single Month object. The following example counts the number of working days in each month of 2012 for each selected resource.

Dim R As Resource 
Dim D As Integer, M As Integer, WorkingDays As Integer 
 
For Each R In ActiveSelection.Resources() 
    WorkingDays = 0 

    With R.Calendar.Years(2012) 
        For M = 1 To .Months.Count 
            WorkingDays = 0 
            For D = 1 To .Months(M).Days.Count 
                If .Months(M).Days(D).Working = True Then 
                    WorkingDays = WorkingDays + 1 
                End If 
            Next D 

            MsgBox "There are " & WorkingDays & " working days in " & _
                .Months(M).Name & " for " & R.Name & "." 
        Next M 
    End With 
Next R

Using the Months Collection

Use the Months property to return a Months collection. The following example counts the number of months in 2012.

ActiveProject.Calendar.Years(2012).Months.Count

Methods

Name
Default

Properties

Name
Application
Calendar
Count
Days
Index
Name
Parent
Shift1
Shift2
Shift3
Shift4
Shift5
Working

[!includeSupport and feedback]