Selection Object
PowerPoint Developer Reference |
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).
Example
Use the Selection property to return the Selection object. The following example places a copy of the selection in the active window on the Clipboard.
Visual Basic for Applications |
---|
|
Use the ShapeRange , SlideRange , or TextRange property to return a range of shapes, slides, or text from the selection.
The following example sets the fill foreground color for the selected shapes in window two, assuming that there's at least one shape selected, and assuming that all selected shapes have a fill whose forecolor can be set.
Visual Basic for Applications |
---|
|
The following example sets the text in the first selected shape in window two if that shape contains a text frame.
Visual Basic for Applications |
---|
|
The following example cuts the selected text in the active window and places it on the Clipboard.
Visual Basic for Applications |
---|
|
The following example duplicates all the slides in the selection (if you're in slide view, this duplicates the current slide).
Visual Basic for Applications |
---|
|
If you don't have an object of the appropriate type selected when you use one of these properties (for instance, if you use the ShapeRange property when there are no shapes selected), an error occurs. Use the Type property to determine what kind of object or objects are selected. The following example checks to see whether the selection contains slides. If the selection does contain slides, the example sets the background for the first slide in the selection.
Visual Basic for Applications |
---|
|
See Also