Click to Rate and Give Feedback
MSDN
MSDN Library
Office Development
Project 2003
SDK Documentation
References
Y
 Year Object, Years Collection Objec...

  Switch on low bandwidth view
 
Year Object, Years Collection Object
Calendar
Years
Year
Multiple objects

Represents a year or the years in a calendar. The Year object is a member of the Years collection.

Using the Year Object

Use Years(Index), where Index is the year index number, to return a single Year 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 Years Collection

Use the Years property to return a Years collection. The following example lists all the years in the active project's calendar.

Dim C As Long, Temp As String
    
For C = 1 To ActiveProject.Calendar.Years.Count
    Temp = Temp & ListSeparator & " " & _
        ActiveProject.Calendar.Years(C + 1983).Name
Next C
        
MsgBox Right$(Temp, Len(Temp) - Len(ListSeparator & " "))
		

Remarks

The Years collection in Project starts at 1984 and ends at 2049.



Methods | Default Method

See Also | Years Property


© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker