Class PrintRange (PowerPoint VBA)

The class PrintRange represents a single range of consecutive slides or pages to be printed.

Set

To use a PrintRange class variable it first needs to be instantiated, for example

Dim pre as PrintRange
Set pre = ActivePresentation.PrintOptions.Ranges(Index:=1)

The following procedures can be used to set variables of type PrintRange: PrintRanges.Item, PrintRanges.Add and PrintOptions.Ranges

Delete

Deletes the specified PrintRange object.

ActivePresentation.PrintOptions.Ranges(1).Delete

End

Returns the number of the last slide in the specified print range.

Dim lngEnd As Long
lngEnd = ActivePresentation.PrintOptions.Ranges(1).End

Parent

Returns the parent object for the specified object.

Start

Returns the number of the first slide in the range of slides to be printed.

Dim lngStart As Long
lngStart = ActivePresentation.PrintOptions.Ranges(1).Start

PrintRanges.Add

Returns a PrintRange object that represents a new print range to be added to the PrintRanges collection.

Syntax : expression.Add (Start, End)

Dim lngStart As Long: lngStart = 
Dim lngEnd As Long: lngEnd = 
Dim pre As PrintRange
Set pre = ActivePresentation.PrintOptions.Ranges.Add(Start:=lngStart, End:=lngEnd)

Arguments

The following arguments are required:

Start (Long) - The number of the slide that is the starting slide in the range.

End (Long) - The number of the slide that is the ending slide in the range.

PrintRanges.ClearAll

Clears all the print ranges from the PrintRanges collection. Use the Add method of the PrintRanges collection to add print ranges to the collection.

ActivePresentation.PrintOptions.Ranges.ClearAll

PrintRanges.Count

Returns the number of objects in the specified collection.

Dim lngCount As Long
lngCount = ActivePresentation.PrintOptions.Ranges.Count

PrintRanges.Item

Returns a single PrintRange object from the specified PrintRanges collection.

Syntax : expression.Item (Index)

Index: The index number of the single PrintRange object in the collection to be returned.

Dim pre As PrintRange
Set pre = ActivePresentation.PrintOptions.Ranges(Index:=1)

PrintRanges.Parent

Returns the parent object for the specified object.