Project.LevelFromDate Property

Project Developer Reference

Returns or sets the starting date of a range in which overallocated resources are leveled. The default is the project start date or the last entered date value. Read/write Variant.

Syntax

expression.LevelFromDate

expression   A variable that represents a Project object.

Return Value
Variant

Example
The following example lets the user change the date range where leveling occurs, if the current range starts on the project start date or finishes on the project finish date.

Visual Basic for Applications
  Sub ChangeLevelingDates()
    Dim Response As Long
    Dim NewFrom As Variant, NewTo As Variant
    
    With ActiveProject
        If Application.DateDifference(.ProjectSummaryTask.Start, .LevelFromDate) = 0 Then
            Response = MsgBox("Overallocated resources are leveled from " & _
                "the project start date. Should that be changed?", vbYesNo)
            If Response = vbYes Then
                NewFrom = InputBox("Date to level from: ")
                .LevelFromDate = NewFrom
            Else
                MsgBox "Resources remain leveled from the project start date."
            End If
        End If
        
        If Application.DateDifference(.ProjectSummaryTask.Finish, .LevelToDate) = 0 Then
            Response = MsgBox("Overallocated resources are leveled to " & _
                "the project finish date. Should that be changed?", vbYesNo)
            If Response = vbYes Then
                NewTo = InputBox("Date to level to: ")
                .LevelToDate = NewTo
            Else
                MsgBox "Resources remain leveled to the project finish date."
            End If
        End If
    End With

End Sub

See Also