PPT Automation: Applying Animation on Paragraphs

G

Guest

I have a problem regarding programmatically animating individual paragaphs.

Suppose I have 5 bullets and I want to Animate them individually. My
animation sequence requires me to apply 2-3 different animation on one bullet
and then animate the next bullet. Hence, I guess I cannot use Animate
MsoAnimateByLevel for this. I tried using AddEffect() but this function
accepts only Shapes. I tried passing Paragraphs to this function but it gave
me an error.

So, can anyone let me know how I can programmatically apply animation to
different paragraphs in a bulleted placeholder?

Thanks a lot.
 
D

David M. Marcovitz

When you do this manually, you have to first set the animation for the
shape and then set each paragraph's animation. When you do this with
automation, you can do the same thing. For example:

Sub SecondDifferent()
Dim oShp As Shape
Set oShp = ActivePresentation.Slides(2).Shapes(2)
ActivePresentation.Slides(2).TimeLine.MainSequence.AddEffect _
oShp, msoAnimEffectAppear, msoAnimateTextByFirstLevel
ActivePresentation.Slides(2).TimeLine.MainSequence(2).EffectType _
= msoAnimEffectBlinds
End Sub

This will take shape 2 on slide 2 (in my case, this was a regular text
placeholder, and I put three paragraphs in it) and set a regular Appear
entrance effect, one paragraph at a time. What that does is actually add
3 things to the MainSequence of the timeline, one for each paragraph. If
I didn't have anything else on the slide animated, the second paragraph
would be MainSequence(2), so the the last line adjusts the animation for
that paragraph to be the Blinds effect instead of the Appear effect.

I don't know specifically what you want to do, but this should get you
started.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
G

Guest

Yeah this works but only when I have to apply same animations on all the
bulleted text. If there are 5 bullets this code will produce this sequence in
the Custom Animation panel:
1 -> Bullet 1 (say .... fly from left)
2 -> Bulllet 2 (fly from left)
3 -> Bullet 3 (fly from left)
4 -> Bullet 4 (fly from left)
5 -> Bullet 5 (fly from left)

But, what I want to do is something like:
1 -> Bullet 1 (fly from left)
2 -> Bullet 2 (fade)
3 -> Bullet 1 (change color to grey)
4 -> Bullet 3 ((fly from left)
5 -> Bullet 2 (fade out)
6 -> Bullet 4 (zoom out)
7 -> Bullet 5 (unfold)
8 -> Bullet 4 ( fade out)

I can do this manually and, hence, I believe there should be a way of doing
this programmatically. AddEffect ( ) only takes shape as parameter where as I
would want to pass something like Shapes(2).TextFrame.TextRange.Paragraph(i)

Thanks.
 
D

David M. Marcovitz

That's not what happened for me. I got exactly the effect you want. The
first line:

ActivePresentation.Slides(2).TimeLine.MainSequence.AddEffect _
oShp, msoAnimEffectAppear, msoAnimateTextByFirstLevel

gives them all the same animation, but the second line:

ActivePresentation.Slides(2).TimeLine.MainSequence(2).EffectType _
= msoAnimEffectBlinds

changes the effect of the second bullet to Blinds. Change the second 2 to
3 to change third bullet's effect, etc.

Now, you will have to tweak this some because you want each line to have
both an entrance and exit effect so you'll probably have to add an
entrance and exit effect for the whole shape (similar to the first line)
and then do some adjustments (like the second line). Once you have
animated the shape with msoAnimateTextByFirstLevel, the
TimeLine.MainSequence contains pointers to each animation effect
(corresponding to each bullet), which can be manipulated individually.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top