Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PPT2007. VBA. Add Motion Path Effect to a Shape

456 views
Skip to first unread message

KL

unread,
Jun 25, 2007, 11:32:42 AM6/25/07
to
Hi there,

Can anyone share a VBA code snippet for adding Motion Path to a shape in PPT2007 please? This one (slightly adjusted) works in
PPT2003, but not in PPT2007:
http://msdn2.microsoft.com/en-us/library/aa201181(office.10).aspx

Thanks and regards,
--
KL
[MVP - Microsoft Excel]
RU: http://www.mvps.ru/Program/Default.aspx
ES: http://mvp.support.microsoft.com/?LN=es-es
EN: http://mvp.support.microsoft.com/?LN=en-us
Profile: http://mvp.support.microsoft.com/profile/Kirill

Shyam Pillai

unread,
Jun 28, 2007, 10:33:26 PM6/28/07
to
That's broken in PPT 2007. Instead use the more reliable way of setting the
motion path by specifying a VML string containing the co-ordinates.

Sub AddMotionPath()

Dim shpNew As Shape
Dim effNew As Effect
Dim aniMotion As AnimationBehavior

Set shpNew = ActivePresentation.Slides(1).Shapes _
.AddShape(Type:=msoShape5pointStar, Left:=0, _
Top:=0, Width:=100, Height:=100)
Set effNew = ActivePresentation.Slides(1).TimeLine.MainSequence _
.AddEffect(Shape:=shpNew, effectId:=msoAnimEffectCustom, _
Trigger:=msoAnimTriggerWithPrevious)
Set aniMotion = effNew.Behaviors.Add(msoAnimTypeMotion)

With aniMotion.MotionEffect
.Path = "M 0 0 L -0.25 0 E"
End With

End Sub

Regards,
Shyam Pillai


Image Importer Wizard
http://skp.mvps.org/iiw.htm

"KL" <nospamla...@pleasehotmail.com> wrote in message
news:OXyYN5zt...@TK2MSFTNGP04.phx.gbl...

KL

unread,
Jun 29, 2007, 3:46:36 PM6/29/07
to
Hi Shyam,

"Shyam Pillai" <Shyam...@Gmail.com> wrote in message news:2A485186-BB66-4851...@microsoft.com...


> That's broken in PPT 2007. Instead use the more reliable way of setting the motion path by specifying a VML string containing the
> co-ordinates.
>
> Sub AddMotionPath()
>
> Dim shpNew As Shape
> Dim effNew As Effect
> Dim aniMotion As AnimationBehavior
>
> Set shpNew = ActivePresentation.Slides(1).Shapes _
> .AddShape(Type:=msoShape5pointStar, Left:=0, _
> Top:=0, Width:=100, Height:=100)
> Set effNew = ActivePresentation.Slides(1).TimeLine.MainSequence _
> .AddEffect(Shape:=shpNew, effectId:=msoAnimEffectCustom, _
> Trigger:=msoAnimTriggerWithPrevious)
> Set aniMotion = effNew.Behaviors.Add(msoAnimTypeMotion)
>
> With aniMotion.MotionEffect
> .Path = "M 0 0 L -0.25 0 E"
> End With
>
> End Sub

Thank you very much, I have already found a thread in another forum where you gave this advice to someone else and it worked nicely
for me.

Reagrds,

0 new messages