Task.WBSSuccessors 属性 (Project)
获取工作分解结构 (WBS) 代码的后续任务,以列表分隔符分隔。 只读 String。
语法
expression。 WBSSuccessors
表达 一个代表 Task 对象的变量。
示例
以下示例要求用户输入任务标识号,然后即可提供其后续任务的更易于识别的 WBS 代码分解形式。
Sub EnumerateSuccessors()
Dim Task As Task
Dim SuccTasks As Tasks
Dim ID As Long
Dim Successors As String
Dim List As String
Dim Count As Integer
ID = CLng(InputBox$("Enter the ID number of the task you wish to examine:"))
Set Task = ActiveProject.Tasks(ID)
Set SuccTasks = Task.SuccessorTasks
Successors = Task.WBSSuccessors
Count = 1
If SuccTasks.Count = 0 Then
List = "Task " & Task.UniqueID & ", " & Task.Name & ", has no successors."
Else
List = "Successors to task " & Task.UniqueID & ", " & Task.Name & ":" & vbCrLf & vbCrLf
Do While InStr(Successors, ListSeparator) <> 0
List = List & SuccTasks(Count).Name & ": " & Mid$(Successors, 1, InStr(Successors, ListSeparator) - 1) & vbCrLf
Successors = Right$(Successors, Len(Successors) - InStr(Successors, ListSeparator))
Count = Count + 1
Loop
List = List & SuccTasks(Count).Name & ": " & Successors
End If
MsgBox List
Set SuccTasks = Nothing
Set Task = Nothing
End Sub
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。