Partager via


PrintOptions.Ranges Property (PowerPoint)

Returns the PrintRanges object, which represents the ranges of slides in the presentation to be printed. Read-only.

Syntax

expression .Ranges

expression A variable that represents a PrintOptions object.

Return Value

PrintRanges

Remarks

If you don't want to print an entire presentation, you must use the Add method to create a PrintRange object for each consecutive run of slides you want to print. For example, if you want to print slide 1, slides 3 through 5, and slides 8 and 9 in a specified presentation, you must create three PrintRange objects: one that represents slide 1; one that represents slides 3 through 5; and one that represents slides 8 and 9. For more information, see the example for this property.

The RangeType property must be set to ppPrintSlideRange for the ranges in the PrintRanges collection to be applied.

To clear all the existing print ranges from the PrintRanges collection, use the ClearAll method.

Specifying a value for the To and From arguments of the PrintOut method sets the contents of the PrintRanges object.

Example

This example prints slide 1, slides 3 through 5, and slides 8 and 9 in the active presentation.

With ActivePresentation

    With .PrintOptions

        .RangeType = ppPrintSlideRange

        With .Ranges

            .Add 1, 1

            .Add 3, 5

            .Add 8, 9

        End With

    End With

    .PrintOut

End With

See Also

Concepts

PrintOptions Object

PrintOptions Object Members