Microsoft Office 2000/Visual Basic Programmer's Guide |
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 PowerPoint presentation from another 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
The PresentationView procedure is available in the modRunPPtPresentation module in PowerPointSamples.dot in the ODETools\V9\Samples\OPG\Samples\CH05 subfolder on the Office 2000 Developer CD-ROM.