Application.SetTPField method (Project)

Sets a value for the percent complete field of one or more tasks in the Team Planner view.

Syntax

expression. SetTPField( _Field_, _Value_, _AllSelectedTasks_, _Create_, _TaskID_, _ProjectName_ )

expression An expression that returns an Application object.

Parameters

Name Required/Optional Data type Description
Field Required String The Field argument can be only "% Complete". You can also use the FieldConstantToFieldName method with pjTaskPercentComplete, as in the example.
Value Required String Value of the Field argument. Values can range from "0" to "100" for percent complete.
AllSelectedTasks Optional Boolean Not used in Project. The value is True, which means that the Field and Value arguments are set for all selected tasks.
Create Optional Boolean Not used in Project.
TaskID Optional Long Not used in Project.
ProjectName Optional String Not used in Project.

Return value

Boolean

Example

The following example sets the selected tasks in the Team Planner view to 40% complete.

Sub TestSetTPField() 
    Dim fieldName As String 
 
    fieldName = FieldConstantToFieldName(pjTaskPercentComplete) 
    Application.SetTPField Field:=fieldName, Value:="40" 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.