Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Slides Object

Office 2007
A collection of all the Slide objects in the specified presentation.

Remarks

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

Example

Use the Slides property to return a Slides collection. Use the Add method to create a new slide and add it to the collection. The following example adds a new slide to the active presentation.

Visual Basic for Applications
ActivePresentation.Slides.Add 2, ppLayoutBlank

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.

Visual Basic for Applications
ActivePresentation.Slides(1).Layout = ppLayoutTitle

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.

Visual Basic for Applications
ActivePresentation.Slides("Big Chart").Layout = ppLayoutTitle

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.

Visual Basic for Applications
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

Visual Basic for Applications
With ActivePresentation.Slides.Range
    .FollowMasterBackground = False
    .Background.Fill.PresetGradient msoGradientHorizontal, _
        1, msoGradientLateSunset
End With



Community Additions

Show:
© 2015 Microsoft