Slide object (PowerPoint)
Represents a slide. The Slides collection contains all the Slide objects in a presentation.
Remarks
Note
Don't be confused if you are trying to return a reference to a single slide but you end up with a SlideRange object. A single slide can be represented either by a Slide object or by a SlideRangecollection that contains only one slide, depending on how you return a reference to the slide. For example, if you create and return a reference to a slide by using the Add method, the slide is represented by a Slide object. However, if you create and return a reference to a slide by using the Duplicate method, the slide is represented by a SlideRange collection that contains a single slide. Because all the properties and methods that apply to a Slide object also apply to a SlideRange collection that contains a single slide, you can work with the returned slide in the same way, regardless of whether it is represented by a Slide object or a SlideRange collection.
The following examples describe how to:
Return a slide that you specify by name, index number, or slide ID number
Return a slide in the selection
Return the slide that's currently displayed in any document window or slide show window you specify
Create a new slide
Example
Use Slides (index), where index is the slide name or index number, or use Slides.FindBySlideID (index), where index is the slide ID number, to return a single Slide object. The following example sets the layout for slide one in the active presentation.
ActivePresentation.Slides(1).Layout = ppLayoutTitle
The following example sets the layout for the slide with the ID number 265.
ActivePresentation.Slides.FindBySlideID(265).Layout = ppLayoutTitle
Use Selection.SlideRange (index), where index is the slide name or index number within the selection, to return a single Slide object. The following example sets the layout for slide one in the selection in the active window, assuming that there's at least one slide selected.
ActiveWindow.Selection.SlideRange(1).Layout = ppLayoutTitle
If there's only one slide selected, you can use Selection.SlideRange to return a SlideRange collection that contains the selected slide. The following example sets the layout for slide one in the current selection in the active window, assuming that there's exactly one slide selected.
ActiveWindow.Selection.SlideRange.Layout = ppLayoutTitle
Use the Slide property to return the slide that's currently displayed in the specified document window or slide show window view. The following example copies the slide that's currently displayed in document window two to the Clipboard.
Windows(2).View.Slide.Copy
Use the Add method to create a new slide and add it to the presentation. The following example adds a title slide to the beginning of the active presentation.
ActivePresentation.Slides.Add 1, ppLayoutTitleOnly
Methods
Name |
---|
ApplyTemplate |
ApplyTemplate2 |
ApplyTheme |
ApplyThemeColorScheme |
Copy |
Cut |
Delete |
Duplicate |
Export |
MoveTo |
MoveToSectionStart |
PublishSlides |
Select |
Properties
See also
PowerPoint Object Model Reference
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.