PrintRanges 集合对象

         
PrintOptions
PrintRanges (PrintRange)

指定演示文稿中所有 PrintRange 对象的集合。每个 PrintRange 对象代表要打印的连续幻灯片或页的范围。

使用 PrintRanges 集合

使用 Ranges 属性返回 PrintRanges 集合。以下示例从当前演示文稿的集合中清除所有以前定义的打印区域。

ActivePresentation.PrintOptions.Ranges.ClearAll

使用 Add 方法创建 PrintRange 对象,并添加到 PrintRanges 集合中。以下示例定义三个打印区域,分别代表当前演示文稿中第一张幻灯片,第三到第五张幻灯片,第八和第九张幻灯片;然后打印这些区域中的幻灯片。

With ActivePresentation.PrintOptions
    .RangeType = ppPrintSlideRange
    With .Ranges
        .ClearAll
        .Add 1, 1
        .Add 3, 5
        .Add 8, 9
    End With
End With
ActivePresentation.PrintOut

使用 Ranges(index) 返回单个 PrintRange 对象,其中 index 是打印区域索引号。以下示例显示一条消息,指示当前演示文稿第一个打印区域的起始和终止幻灯片编号。

With ActivePresentation.PrintOptions.Ranges
    If .Count > 0 Then
        With .Item(1)
            MsgBox "Print range 1 starts on slide " & .Start & _
                " and ends on slide " & .End
        End With
    End If
End With