Application.LinkTasks 方法 (Project)

链接“甘特图”、“日历”、“任务工作表”或“任务分配状况”视图中的选定任务。

语法

expressionLinkTasks

expression:表示 Application 对象的变量。

返回值

Boolean

示例

以下示例将创建一些任务并链接它们。

Sub Link_Tasks() 
 
 'Activate Task Sheet view 
 ViewApply Name:="Task Sheet" 
 
 ' Create a coupe of tasks 
 RowInsert 
 SetTaskField Field:="Name", Value:="TestTask-2" 
 SetTaskField Field:="Duration", Value:="5" 
 
 RowInsert 
 SetTaskField Field:="Name", Value:="TestTask-1" 
 SetTaskField Field:="Duration", Value:="10" 
 
 'Select tasks 
 SelectRow 
 SelectRow Row:=1, Add:=True 
 
 'Link the two tasks 
 LinkTasks 
 
 'delete the tasks 
 ActiveProject.Tasks("TestTask-1").Delete 
 ActiveProject.Tasks("TestTask-2").Delete 
End Sub

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。