Share via


Task.FixedCost Property

Project Developer Reference

Returns or sets a fixed cost for a task. Read/write Variant.

Syntax

expression.FixedCost

expression   A variable that represents a Task object.

Return Value
Variant

Example
The following example increases the fixed costs of marked tasks by an amount specified by the user.

Visual Basic for Applications
  Sub IncreaseFixedCosts()
Dim T As Task           ' Task object used in For Each loop
Dim Entry As String     ' Amount to add to any existing fixed cost

Entry = InputBox$("Increase the fixed costs of marked tasks by what amount?")

' If entry is invalid, display error message and exit Sub procedure.
If Not IsNumeric(Entry) Then
    MsgBox ("You didn't enter a numeric value.")
    Exit Sub
End If

' Increase the fixed costs of marked tasks by the specified amount.
For Each T In ActiveProject.Tasks
    If T.Marked Then
        T.<strong class="bterm">FixedCost</strong> = T.<strong class="bterm">FixedCost</strong> + Val(Entry)
    End If
Next T

End Sub

See Also