Share via


How Not to Animate Your Slide

Hey, remember that nifty tip in my last blog entry about how to set up a sound file so that’s it’s ‘invisible’ and plays automatically when the slide loads? Nice trick, huh? Turns out that entry, in addition to being my first official PowerPoint blog entry, afforded me the rare opportunity to be horribly wrong with my advice in two completely different ways. Not only should you not set up the file to play automatically using the code I wrote, but even if you wrote the correct code, it might well screw up other animation effects for your entire slide.

Here’s the deal:

Unbeknownst to me at the time, it turns out that in PowerPoint 2002 and above there are actually two separate, incompatible sections of the object model that enable you to set up animation effects for your slide. The new, expanded object model section, contained in the TimeLine object, provides more flexibility and options for richer interactive animations then ever before. This is the object model section you should use for animation whenever possible. The other section, contained in the AnimationSettings object, was retained strictly for backward compatibility reasons. Unless you’re programming for PowerPoint 2000 and below, never use the Animation Settings object. (This, of course, make me wonder why this section of the object model wasn’t hidden for PowerPoint 2002 and above, but that’s a minor digression.)

Still with me? Because of basic differences in the way they are organized, the two object models are not compatible. The AnimationSettings object model only supports entry effects for shapes (which is one reason the TimeLine object model was created, to offer users multiple effects for a single shape.) Here’s where the fun begins. If your code uses the AnimationSettings object to set any effect properties, PowerPoint assumes you are programming for PowerPoint 2000 or below, and therefore deletes any animation effects that are not entry effects, for the entire slide. This includes effects that were added using the user interface.

Ouch.

So naturally, the code I wrote for my tip inserted the sound file ‘offscreen’, and then used the AnimationSettings object to set the file to play when the slide loaded. Let me apologize right now if I blew up anyone’s slide and you’ve been trying to figure out why ever since.

Now, normally at this point, having finished my mea culpa, I would show you the proper way to set the file to play automatically, using the TimeLine object model.

Except it doesn’t work that way either.

Turns out there’s currently a bug in the PowerPoint object model. You set a file to play automatically by setting PlaySettings.PlayOnEntry to True. You can access the PlaySettings object through either object model. Unfortunately, because of the bug, when you access certain properties of the PlaySettings object, even if you do so through the TimeLine object model, PowerPoint assumes you are programming for PowerPoint 2000 or below, and—you guessed it—deletes any animation effects that are not entry effects, for the entire slide.

This is true for the following PlaySettings properties: ActionVerb, HideWhileNotPlaying, PauseAnimation, PlayOnEntry, and StopAfterSlides. It seems like you can access the following two properties and not suffer any ill effects, but no guarantees: LoopUntilStopped and RewindMovie.

Did I mention that I was still learning my way around the PowerPoint object model?

Actually, I’m in the process right now of writing several articles on how to create, customize and control animation effects in PowerPoint. And unlike these helpful blog entries, the articles will be tech reviewed by developers on the PowerPoint team. Stay tuned.

Comments

  • Anonymous
    May 24, 2004
    Andrew, Tks , this helped me finish a paper today !