Reverse Motion Path with VBA

T

TimeForHelp

Is there a property in VBA that will do the same thing as right clicking a
motion path and selecting Reverse Path Direction-or a workaround. My project
is
bringing multiple pieces of a picture onto a slide from all directions and
visually assembling the picture. I have animated the reverse, the picture
breaking into pieces and flying off slide. If I could reverse the paths
(programatically for future uses) I'd be there.
TimeForHelp
 
B

Bill Dilworth

My mother was an English teacher. Whenever my term papers were due for my
various classes I would ask her to help me spell words. Inevitably, her
response was, "How do you think it is spelled?" At the time, I hated that
answer. Since I have gotten older, I have begun to see the wisdom of that
approach and now use it on my kids.

What code have you tried to reverse the motion path? What object commands
have you ruled out?


--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
vestprog2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.com
..
 
L

lpupa

My mother was an English teacher. Whenever my term papers were due for my
various classes I would ask her to help me spell words. Inevitably, her
response was, "How do you think it is spelled?" At the time, I hated that
answer. Since I have gotten older, I have begun to see the wisdom of that
approach and now use it on my kids.

What code have you tried to reverse the motion path? What object commands
have you ruled out?

--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
vestprog2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.com





- Show quoted text -

Thanks for looking at this, Bill:

Trial #1
Sub AddShapeAndEffect()
Dim shpNew As Shape
Dim sldNew As Slide
Dim EffNew As Effect

Set sldNew =
ActivePresentation.Slides.Add(index:=ActivePresentation.Slides.count +
1, Layout:=ppLayoutBlank)
Set shpNew = sldNew.Shapes.AddShape(Type:=msoShape5pointStar, _
Left:=150, Top:=72, Width:=400, Height:=400)
Set EffNew = sldNew.TimeLine.MainSequence.AddEffect(Shape:=shpNew,
_
effectId:=msoAnimEffectPathLeft,
Trigger:=msoAnimTriggerOnPageClick)
With EffNew
.Timing.AutoReverse = msoTrue
End With
End Sub

Trial #2
Sub AnimateInReverse()

Dim sldNew As Slide
Dim timeMain As TimeLine
Dim shpNew As Shape

With ActivePresentation
Set sldNew
= .Slides.Add(index:=ActivePresentation.Slides.count + 1,
Layout:=ppLayoutBlank)
Set shpNew = sldNew.Shapes.AddShape(Type:=msoShapeRectangle, _
Left:=100, Top:=100, Width:=300, Height:=150)
Set timeMain = sldNew.TimeLine
End With

With timeMain.MainSequence
.ConvertToAnimateInReverse _
Effect:=.AddEffect(Shape:=shpNew,
effectId:=msoAnimEffectPathLeft), _
AnimateInReverse:=msoTrue
End With

End Sub

Trial #3
Slide and Shape already created and animated.

Sub ReverseAnimation()
Dim oSlide As Slide
Dim oShape As Shape
Dim TimeMain As TimeLine
Dim Eff As Effect

Set oSlide = ActivePresentation.Slides(78)
Set oShape = oSlide.Shapes(1)
Set TimeMain = oSlide.TimeLine
Set Eff = TimeMain.MainSequence(1)

'With Eff.Behaviors(1).MotionEffect

'No Properties found in MotionEffect Behavior to
reverse animation
End Sub
 
B

Bill Dilworth

I should start by saying someone else may have a better solution to this,
but here is what I have experienced.

You have discovered that auto-reverse and reverse path are not the same, and
that text reverse and path reverse are not either. You know a lot more
about animation coding than you would have is I had just told you the bottom
line.

Now you can also understand some of the frustration of not having the full
Object Model revealed. This effect should be accessible in the
ActivePresentation.Slides(1).TimeLine.MainSequence(1).Behaviors(1).Timing.Speed
= -1
format, but negative values are not allowed. When you reverse the path
manually, this is the value that is changed, but you can't change it via VBA
code.

Sooooo, how does one change this? This can be set and changed, just not
from within VBA. You must use the HTML script code behind PowerPoint to
change this setting. Look for the line of script (Tools => Macro => MS
Script Editor) and search for this line of code in the Slide1 HTML page.
<oa:animationMotion id="TimeMode5" dur="1.0" speed="1.0" fill="hold"
and change the speed to "-1.0", close and go back to the main PowerPoint
screen to refresh the presentation.

This will reverse the motion path direction.

Doing this from VBA code is a bit tricky. You will need to use the
ActivePresentation.HTMLProject.HTMLProjectItems("Slide1")
to directly modify the HTML script code for the slide.

So, the easy answer is yes and no. Yes it can be done, but no, you probably
don't want to do what you have to in order to achieve it.


--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
vestprog2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.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