Share via


MaxUnits Property

Sets or returns the maximum number of units of a resource, as specified in the current row of the Resource Availability grid for the resource. The current row is that where the date range between the Available From and Available To columns includes the current date. Read/write Variant.

Remarks

The MaxUnits property does not return any meaningful information for material resources. Setting a value returns a trappable error (error code 1101) when applied to material resources.

Example

The following example sets the maximum units of each resource in the active project to a number specified by the user.

Sub SetDefaultMaxUnits()

    Dim Entry As String     ' Maximum units specified by user
    Dim R As Resource       ' Resource object used in loop

    Entry = InputBox$("Enter the default maximum units for each resource.")

    If IsNumeric(Entry) Then
        For Each R In ActiveProject.Resources
            R.MaxUnits = Entry
        Next R
    Else
        MsgBox ("You didn't enter a numeric value.")
    End If
    
End Sub

Applies to | Resource Object, Resources Collection Object

See Also | AvailableFrom Property | AvailableTo Property | Overallocated Property | Units Property