Share via


Day Object, Days Collection Object

Month
Days
Day
Multiple objects

Represents a day or the days in a month. The Day object is a member of the Days collection.

Using the Day Object

Use Days(Index), where Index is the day index number or PjWeekday constant, to return a single Day object. The following example counts the number of working days in the month of September 2002 for each selected resource.

Dim R As Resource, D As Integer, WorkingDays As Integer

For Each R In ActiveSelection.Resources()
    WorkingDays = 0
    With R.Calendar.Years(2002).Months(pjSeptember)
        For D = 1 To .Days.Count
            If .Days(D).Working = True Then
                WorkingDays = WorkingDays + 1
            End If
        Next D
    End With
    MsgBox "There are " & WorkingDays & " working days in " _
        & R.Name & "'s calendar."
Next R

Using the Days Collection

Use the Days property to return a Days collection. The following example counts the number of days in the month of September 2002.

ActiveProject.Calendar.Years(2002).Months(pjSeptember).Days.Count

Properties | Application Property | Calendar Property | Calendar Property | Count Property | Days Property | Index Property | Item Property | Name Property | Parent Property | Shiftn Property | Working Property

Methods | Default Method

Parent Objects | Month Object, Months Collection Object

Child Objects | Calendar Object, Calendars Collection Object | Shift Object

See Also | Days Property