SplitParts 对象 (Project)

包含 SplitPart 对象的集合。

示例

使用 SplitParts 集合对象

使用 SplitParts (Index ) (其中Index 是任务索引号的索引号)可返回单个 SplitPart 对象。 下面的示例列出开始和完成每个任务部分的活动单元格中任务的时间。

Dim Part As Long, Portions As String 

 

For Part = 1 To ActiveCell.Task.SplitParts.Count 

 With ActiveCell.Task 

 Portions = Portions & "Task portion " & Part & ": Start on " & _ 

 .SplitParts(Part).Start & ", Finish on " & _ 

 .SplitParts(Part).Finish & vbCrLf 

 End With 

Next Part 

 

MsgBox Portions

使用 SplitParts 集合

使用 SplitParts 属性可以返回一个 SplitParts 集合。 以下示例将返回活动项目中每个任务的部分数。

Dim T As Task 

 

For Each T In ActiveProject.Tasks 

 If Not (T Is Nothing) Then 

 MsgBox T.Name & ": " & T.SplitParts.Count 

 End If 

 

Next T

使用 Split 方法 (Task 对象) 将 SplitPart 对象添加到 SplitParts 集合。 (Split 方法在 task 中创建拆分。) 以下示例在任务中创建从星期三到星期一的拆分。

ActiveCell.Task.Split "10/2/02", "10/7/02"

方法

名称
Add

属性

名称
Application
Count
项目
Parent

另请参阅

项目对象模型

支持和反馈

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