Share via

Editing custom paths using vba

Anonymous
2014-01-12T08:42:42+00:00

I am wanting to do some work on motion paths (lines, arcs, turns and custom paths) with vba but am struggling to figure out how to add and edit points on a motion path. I have seen Shyam Pillai's awesome addin which allows paths to be combined and aligned with vba, so I'm assuming that they can be edited - I just can't figure out how to reference the necessary properties/methods! Any suggestions would be gratefully received!

Thanks, Gordon

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
2014-01-12T10:45:23+00:00

Just to warn you this is not easy!

The path data is stored as a VML string and can be accessed (assuming oeff is a reference to the animation effect) using:

oeff.Behaviors(1).MotionEffect.Path

It will error if oeff is not a motion path of course.

Was this answer helpful?

0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2014-01-13T22:24:48+00:00

    Would definitely be a handy thing to get but never mind - thank you for your alternative suggestion! I've successfully managed to do what I was aiming for - create a duplicate shape at the end of the path, then be able to move the duplicate around to get it neatly lined up, adjust the final point of the path to the centre of the duplicate and then finally delete the duplicate.

    Many thanks for your help,

    Gordon

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2014-01-13T11:21:55+00:00

    It isn't possible to get the selected effect in the Custom animation pane (AFAIK and I have tried!)

    Best you can do is find the first motion path for a selected shape by looping through the timeline and checking the effect.Shape.id against the selected shapes id and looking for an effect where Behaviors(1).Type=1 (motion)

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2014-01-13T02:53:37+00:00

    Thank you for this! I had discovered this property already, but had not attempted to set it as it was listed as being a read-only property. I think I can handle this - I'm only really interested in the end point of the motion path so it isn't too bad.

    One further question though - is it possible to get the currently selected effect using vba? I know how to get the current shape/text/slide using activewindow.selection, but the this returns a type 0 if an effect is selected.

    Many thanks for your help,

    Gordon

    Was this answer helpful?

    0 comments No comments