Task Object, Tasks Collection Object
Multiple objects Tasks Task Multiple objects |
Represents a task or tasks. The Task object is a member of the Tasks collection.
Using the Task Object
Use Tasks(Index), where Index is the task index number or task name, to return a single Task object. The following example prints the names of every resource assigned to every task in the active project.
Dim Temp As Long, A As Assignment
Dim TaskName As String, Assigned As String, Results As String
For Temp = 1 To ActiveProject.Tasks.Count
TaskName = "Task: " & ActiveProject.Tasks(Temp).Name & vbCrLf
For Each A In ActiveProject.Tasks(Temp).Assignments
Assigned = A.ResourceName & ListSeparator & " " & Assigned
Next A
Results = Results & TaskName & "Resources: " & _
Left$(Assigned, Len(Assigned) - Len(ListSeparator & " ")) & vbCrLf & vbCrLf
TaskName = ""
Assigned = ""
Next Temp
MsgBox Results
Using the Tasks Collection
Use the Tasks property to return a Tasks collection. The following example displays the name of every task in the selection.
Dim T As Task, Names As String
For Each T In ActiveSelection.Tasks
Names = Names & T.Name & vbCrLf
Next T
MsgBox Names
Use the Add method to add a Task object to the Tasks collection. The following example adds a new task to the end of the task list.
ActiveProject.Tasks.Add "Hang clocks"
Properties | ActualCost Property | ActualDuration Property | ActualFinish Property | ActualOvertimeCost Property | ActualOvertimeWork Property | ActualOvertimeWorkProtected Property | ActualStart Property | ActualWork Property | ActualWorkProtected Property | ACWP Property | Application Property | Assignments Property | BaselinenCost Property | BaselinenDuration Property | BaselinenDurationEstimated Property | BaselinenFinish Property | BaselinenStart Property | BaselinenWork Property | BCWP Property | BCWS Property | Calendar Property | Confirmed Property | ConstraintDate Property | ConstraintType Property | Contact Property | Costn Property | CostVariance Property | Count Property | CPI Property | Created Property | Critical Property | CV Property | CVPercent Property | Daten Property | Deadline Property | Durationn Property | DurationnEstimated Property | DurationVariance Property | EAC Property | EarlyFinish Property | EarlyStart Property | EarnedValueMethod Property | EffortDriven Property | EnterpriseCostn Property | EnterpriseDaten Property | EnterpriseDurationn Property | EnterpriseFlagn Property | EnterpriseNumbern Property | EnterpriseOutlineCoden Property | EnterpriseProjectCostn Property | EnterpriseProjectDaten Property | EnterpriseProjectDurationn Property | EnterpriseProjectFlagn Property | EnterpriseProjectNumbern Property | EnterpriseProjectOutlineCoden Property | EnterpriseProjectTextn Property | EnterpriseTextn Property | Estimated Property | ExternalTask Property | Finish Property | Finishn Property | FinishSlack Property | FinishVariance Property | FixedCost Property | FixedCostAccrual Property | Flagn Property | FreeSlack Property | GroupBySummary Property | HideBar Property | Hyperlink Property | HyperlinkAddress Property | HyperlinkHREF Property | HyperlinkScreenTip Property | HyperlinkSubAddress Property | ID Property | IgnoreResourceCalendar Property | Index Property | Item Property | LateFinish Property | LateStart Property | LevelIndividualAssignments Property | LevelingCanSplit Property | LevelingDelay Property | LinkedFields Property | Marked Property | Milestone Property | Name Property | Notes Property | Numbern Property | Objects Property | OutlineChildren Property | OutlineCoden Property | OutlineLevel Property | OutlineNumber Property | OutlineParent Property | Overallocated Property | OvertimeCost Property | OvertimeWork Property | Parent Property | PercentComplete Property | PercentWorkComplete Property | PhysicalPercentComplete Property | Predecessors Property | PredecessorTasks Property | PreleveledFinish Property | PreleveledStart Property | Priority Property | Project Property | Recurring Property | RegularWork Property | RemainingCost Property | RemainingDuration Property | RemainingOvertimeCost Property | RemainingOvertimeWork Property | RemainingWork Property | ResourceGroup Property | ResourceInitials Property | ResourceNames Property | ResourcePhonetics Property | Resources Property | ResponsePending Property | Resume Property | Rollup Property | SPI Property | SplitParts Property | Start Property | Startn Property | StartSlack Property | StartVariance Property | Status Property | Stop Property | Subproject Property | SubprojectReadOnly Property | Successors Property | SuccessorTasks Property | Summary Property | SV Property | SVPercent Property | TaskDependencies Property | TCPI Property | TeamStatusPending Property | Textn Property | Textn Property | TotalSlack Property | Type Property | UniqueID Property | UniqueIDPredecessors Property | UniqueIDSuccessors Property | UpdateNeeded Property | VAC Property | WBS Property | WBSPredecessors Property | WBSSuccessors Property | Work Property | WorkVariance Property
Methods | Add Method | AppendNotes Method | Delete Method | GetField Method | LinkPredecessors Method | LinkSuccessors Method | OutlineHideSubtasks Method | OutlineIndent Method | OutlineOutdent Method | OutlineShowAllTasks Method | OutlineShowSubtasks Method | SetField Method | Split Method | TimeScaleData Method | UnlinkPredecessors Method | UnlinkSuccessors Method
Parent Objects | Cell Object | Project Object, Projects Collection Object | Selection Object
Child Objects | Assignment Object, Assignments Collection Object | Resource Object, Resources Collection Object | SplitPart Object, SplitParts Collection Object | TaskDependency Object, TaskDependencies Collection Object | TimeScaleValue Object, TimeScaleValues Collection Object
See Also | Task Property | Tasks Property