Share via

Modify animation path VBA

Anonymous
2012-02-08T19:20:27+00:00

I have attempt to create and modify an programmatically generate motion path.  Although i am able to create a complex path  programmatically  the actual red and green line still goes straight down.  Is there a way to  programmatically   have it reflect the true motion path on the animation.

Sub Makeline()

Dim shpNew As Shape

Dim effNew As Effect

Dim aniMotion As AnimationBehavior

ActivePresentation.Slides(1).Shapes(1).Select

Set shpNew = ActiveWindow.Selection.ShapeRange.Item(1)

'Set effNew = ActivePresentation.Slides(1).TimeLine.MainSequence.AddEffect(Shape:=shpNew, effectid:=msoAnimEffectAppear)

Set effNew = ActivePresentation.Slides(1).TimeLine.MainSequence _

.AddEffect(Shape:=shpNew, effectid:=msoAnimEffectPathDown, _

trigger:=msoAnimTriggerOnPageClick, Level:=msoAnimateLevelNone)

Set aniMotion = effNew.Behaviors.Add(msoAnimTypeMotion)

With aniMotion.MotionEffect

.Path = "M 2.22222E-6 4.44444E-6 C 0.01077 0.06366 0.05156 0.08819 0.09254 0.11018 C 0.46979 0.19352 0.48924 0.18842 0.48924 0.18842 "

End With

With effNew.Timing

.Duration = 2

.TriggerType = msoAnimTriggerOnPageClick

End With

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2012-02-08T21:00:15+00:00

If you are going to use the built in effect id - msoAnimEffectPathDown then modify that behavior itself instead of adding one.

Change: Set aniMotion = effNew.Behaviors.Add(msoAnimTypeMotion)

to

Set aniMotion = effNew.Behaviors(1)

This should do. You make may have to referesh your slide in design view so that you don't see two motion paths when this operation is done.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2012-02-08T22:44:14+00:00

    THANKS!!!!

    Was this answer helpful?

    0 comments No comments