Task.UnlinkSuccessors 方法 (Project)
从某一任务中删除一个或多个后续任务。
语法
expression。 UnlinkSuccessors
( _Tasks_
)
表达 一个代表 Task 对象的变量。
参数
名称 | 必需/可选 | 数据类型 | 说明 |
---|---|---|---|
Tasks | 必需 | Object | 可以是一个 任务 或 任务 的对象,它指定要删除的一个或多个任务作为后续任务。 |
返回值
Nothing
示例
以下示例将从活动项目的每项任务中删除指定的后续任务。
Sub RemoveSuccessor()
Dim Entry As String ' Successor specified by user
Dim SuccTask As Task ' Successor task object
Dim T As Task ' Task object used in For Each loop
Dim S As Task ' Successor (task object) used in loop
Entry = InputBox$("Enter the name of a successor to unlink from every task in this project.")
Set SuccTask = Nothing
' Look for the name of the successor in tasks of the active project.
For Each T In ActiveProject.Tasks
If T.Name = Entry Then
Set SuccTask = T
Exit For
End If
Next T
' Remove the successor from every task in the active project.
If Not (SuccTask Is Nothing) Then
For Each T In ActiveProject.Tasks
For Each S In T.SuccessorTasks
If S.Name = Entry Then
T.UnlinkSuccessors SuccTask
Exit For
End If
Next S
Next T
End If
End Sub
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。