Slides Object (PowerPoint)
A collection of all the Slide objects in the specified presentation.
If your Visual Studio solution includes the Microsoft.Office.Interop.PowerPoint reference, this collection maps to the following types:
Microsoft.Office.Interop.PowerPoint.Slides.GetEnumerator (to enumerate the Slide objects.)
The following examples describe how to:
Create a slide and add it to the collection
Return a single slide that you specify by name, index number, or slide ID number
Return a subset of the slides in the presentation
Apply a property or method to all the slides in the presentation at the same time
Use Slides(index), where index is the slide name or index number, or use the 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.
The following example sets the layout for the slide named "Big Chart" in the active presentation. Note that slides are assigned automatically generated names of the form Sliden (where n is an integer) when they're created. To assign a more meaningful name to a slide, use the Name property.
Use Slides.Range(index), where index is the slide index number or name or an array of slide index numbers or an array of slide names, to return a SlideRange object that represents a subset of the Slides collection. The following example sets the background fill for slides one and three in the active presentation.
With ActivePresentation.Slides.Range(Array(1, 3)) .FollowMasterBackground = False .Background.Fill.PresetGradient msoGradientHorizontal, _ 1, msoGradientLateSunset End With
If you want to do something to all the slides in your presentation at the same time (such as delete all of them or set a property for all of them), use Slides.Range with no argument to construct a SlideRange collection that contains all the slides in the Slides collection, and then apply the appropriate property or method to the SlideRange collection. The following example sets the background fill for all the slides in the active presentation