SplitPart 对象(Project)SplitPart object (Project)

表示任务的某一部分。Represents a task portion. SplitPart 对象是 SplitParts 集合的成员之一。The SplitPart object is a member of the SplitParts collection.


使用 SplitPart 对象Using the SplitPart Object

使用SplitParts索引),其中索引是任务部分的索引号,返回单个SplitPart对象。Use SplitParts (Index ), whereIndex is the index number of the task portion, to return a single SplitPart object. 下面的示例列出开始和完成每个任务部分的活动单元格中任务的时间。The following example lists the start and finish times of each task portion of the task in the active cell.

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 集合Using the SplitParts Collection

使用 SplitParts 属性可以返回一个 SplitParts 集合。Use the SplitParts property to return a SplitParts collection. 以下示例将返回活动项目中每个任务的部分数。The following example returns the number of task portions for each task in the active project.

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** 方法(任务对象)将SplitPart对象添加到SplitParts集合中。Use the Split method (Task object) to add a SplitPart object to the SplitParts collection. Split方法在任务中创建拆分。)下面的示例在10月2012中创建一个从星期三到星期一的任务拆分。(The Split method creates a split in a task.) The following example creates a split in the task from Wednesday to Monday, in October of 2012.

ActiveCell.Task.Split "10/3/2012", "10/8/2012"





支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.