Share via


Running a Slide Show from a Presentation

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

You use properties of the SlideShowSettings object to specify how you want a slide show to appear and which slides to include in the show. You use the SlideShowSettings object's Run method to start the slide show. You access the SlideShowSettings object by using the Presentation object's SlideShowSettings property. These objects and properties are most useful if you want to create and run a Microsoft® PowerPoint® presentation from another Microsoft® Office application. For example, the following code is from the PresentationView sample procedure, and it is used in Microsoft® Word to take a Word outline and display it as a PowerPoint presentation. The slide show runs automatically, and when it is finished, it returns the focus to the Word document from which the macro was run.

Set prsPres = ppApp.Presentations.Open(strOutlineFileName)
' Format the presentation and set the slide show timings.
With prsPres
   .ApplyTemplate strTemplate
   With .Slides.Range.SlideShowTransition
      .AdvanceTime = intShowSlide
      .AdvanceOnTime = msoTrue
   End With
   ' Run the slide show, showing each slide once,
   ' and then end the show and close the presentation.
   With .SlideShowSettings
      .AdvanceMode = ppSlideShowUseSlideTimings
      .ShowType = ppShowTypeSpeaker
      .StartingSlide = 1
      .EndingSlide = prsPres.Slides.Count
      Set objCurrentShow = .Run.View
      Do Until objCurrentShow.State = ppSlideShowDone
         DoEvents
      Loop
   End With
End With

See Also

Working with the Presentation Object | Working with Open Presentations | Working with Existing Presentations | Creating a New Presentation | Formatting a Presentation