Operating a Slide Show

     

With your presentation created and saved, slides added and set up, and shapes inserted and formatted, your file is just about ready to roll. All that remains is to add a few slide show settings and transition effects. This section shows you how to do that as well as how to run your slide show when it's complete.

Slide Show Transitions

Each Slide object has a SlideShowTransition property that determines how the slide advances during a slide show. This property is actually a SlideShowTransitions object, and you set up the transition effect by modifying this object's properties. Here's a list of the key properties:

graphics/note_icon.gif

To allow a slide to advance based on time, you also need to set the SlideShowSettings object's AdvanceMode property to ppSlideShowUseSlideTimings . This object is a property of the Presentation object, and I'll discuss it in detail in the section "Slide Show Settings."


Slide .SlideShowTransition.AdvanceOnClick ” For the specified Slide , this property returns or sets whether or not the slide advances when it's clicked. Set this property to True to advance the slide by clicking it.

Slide .SlideShowTransition.AdvanceOnTime ” For the specified Slide , this property returns or sets whether or not the slide advances after a period of time has elapsed (as set by the AdvanceTime property). Set this property to True to advance the slide after a period of time.

Slide .SlideShowTransition.AdvanceTime ” This property returns or sets the amount of time, in seconds, after which the specified Slide will advance, assuming the AdvanceOnTime property is set to True.

Slide .SlideShowTransition.EntryEffect ” A constant that determines the special effect used in the transition for the specified Slide . Look up this property in the VBA Help system to see the dozens of available constants.

Slide .SlideShowTransition.Hidden ” This property returns or sets whether or not the specified Slide is hidden during the slide show. Use True to hide the slide or False to make the slide visible.

Slide .SlideShowTransition.Speed ” This property returns or sets the speed of the transition for the specified Slide . Use one of the following constants:

  • ppTransitionSpeedSlow

  • ppTransitionSpeedMedium

  • ppTransitionSpeedFast

  • ppTransitionSpeedMixed

Slide Show Settings

The Presentation object has a SlideShowSettings property that controls various global settings for the slide show. This property is actually a SlideShowSettings object, and the settings are the properties of this object. Here's a rundown of the settings you'll utilize most often:

Presentation .SlideShowSettings.AdvanceMode ” Returns or sets how the slides advance for the specified Presentation . Use ppSlideShowManualAdvance to advance slides manually (by clicking) or ppSlideShowUseSlideTimings to advance slides based on the AdvanceTime property for each slide. You can also use the ppSlideShowRehearseNewTimings constant to run the slide show in Rehearsal mode (which lets you set the timings by advancing the slides manually).

Presentation .SlideShowSettings.EndingSlide ” Returns or sets the index number of the last slide that is displayed in the slide show for the specified Presentation .

Presentation .SlideShowSettings.LoopUntilStopped ” Returns or sets whether or not the slide show for the specified Presentation plays continuously. Set this property to True to play the slide show in a continuous loop until the user presses Esc; set this property to False to play the slide show just once.

Presentation .SlideShowSettings.ShowType ” Returns or sets the slide show type for the specified Presentation . Use ppShowTypeSpeaker (for the standard, full-screen slide show), ppShowTypeWindow (to run the slide show in a window), or ppShowTypeKiosk (to run the slide show in kiosk mode ”full screen with a continuous loop).

Presentation .SlideShowSettings.ShowWithAnimation ” Returns or sets whether or not the slide show for the specified Presentation uses the animation settings applied to each slide's shapes. Set this property to True to enable animation; use False to disable animation.

Presentation .SlideShowSettings.ShowWithNarration ” Returns or sets whether or not the slide show for the specified Presentation uses narration. Set this property to True to enable narration; use False to disable narration.

Presentation .SlideShowSettings.StartingSlide ” Returns or sets the index number of the first slide that is displayed in the slide show for the specified Presentation .

Running the Slide Show

At long last you're ready to display the presentation's slide show for all to see. To do so, simply invoke the Run method of the SlideShowSettings object:

  Presentation  .SlideShowSettings.Run 

For example, Listing 9.6 shows the last of the Juggling application's procedures. In this case, the procedure presents a dialog box that asks the user whether he or she wants to run the slide show. If Yes is clicked, some transition effects are applied to the instruction slides, and then the Run method is invoked.

Listing 9.6. This Procedure Asks the User if He or She Wants to Run the Presentation's Slide Show
 Sub RunJugglingSlideShow     If MsgBox("Start the slide show?", vbYesNo, "Juggling") _              = vbYes Then         With pres             .Slides("Juggling1").SlideShowTransition.EntryEffect = ppEffectBlindsHorizontal             .Slides("Juggling2").SlideShowTransition.EntryEffect = pEffectCheckerboardAcross             .Slides("Juggling3").SlideShowTransition.EntryEffect = ppEffectBoxIn             .Slides("Juggling4").SlideShowTransition.EntryEffect = ppEffectStripsLeftDown             .SlideShowSettings.Run         End With     End If End Sub 

The Absolute Minimum

This chapter showed you the ins and outs of PowerPoint VBA. You began with a look at a few properties of PowerPoint's Application object. From there, you went through a number of PowerPoint-specific objects, including the Presentation , Slide , and Shape objects. I then showed you how to work with slide shows in your VBA code. Throughout this chapter, I illustrated the concepts with a sample application that creates a PowerPoint presentation from scratch.

Here's a list of chapters where you'll find related information:

  • For a general discussion of VBA objects, see Chapter 5, "Working with Objects."

  • I show you how to work with For Each...Next , For..Next , and Select Case in Chapter 6, "Controlling Your VBA Code."

  • You can also assign sound effects to slide animations and slide show transitions. I show you how it's done in Chapter 12, "Interacting with the User."




Absolute Beginner's Guide to VBA
Absolute Beginners Guide to VBA
ISBN: 0789730766
EAN: 2147483647
Year: 2003
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net