Class Selection (PowerPoint VBA)

The class Selection represents the selection in the specified document window. The Selection object is deleted whenever you change slides in an active slide view (the Type property will return ppSelectionNone).

The main procedures of class Selection are Copy and Delete


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

Dim slc as Selection
Set slc = ActiveWindow.Selection

Selection class variables can be set using the DocumentWindow.Selection procedure.


These are the main methods of the Selection class

Copy - Copies the specified object to the Clipboard.


Delete - Deletes the specified Selection object.



ChildShapeRange returns a ShapeRange object that represents the child shapes of a selection.

Dim sreChildShapeRange As ShapeRange
Set sreChildShapeRange = ActiveWindow.Selection.ChildShapeRange

HasChildShapeRange true if the selection contains child shapes.

Dim booHasChildShapeRange As Boolean
booHasChildShapeRange = ActiveWindow.Selection.HasChildShapeRange

Parent returns the parent object for the specified object.

Dim objParent As Object
Set objParent = ActiveWindow.Selection.Parent

ShapeRange returns a ShapeRange object that represents all the slide objects that have been selected on the specified slide.

Dim sreShapeRange As ShapeRange
Set sreShapeRange = ActiveWindow.Selection.ShapeRange

SlideRange returns a SlideRange object that represents a range of selected slides.

Dim sreSlideRange As SlideRange
Set sreSlideRange = ActiveWindow.Selection.SlideRange

TextRange returns a TextRange object that represents the selected text.

Dim treTextRange As TextRange
Set treTextRange = ActiveWindow.Selection.TextRange

TextRange2 returns the TextRange2 object of the current Selection object.

Dim tr2TextRange2 As Office.TextRange2
Set tr2TextRange2 = ActiveWindow.Selection.TextRange2

Type represents the type of objects in a selection.

Dim pstType As PpSelectionType
pstType = ActiveWindow.Selection.Type