Is there any event that fire for PowerPoint animations at start and end? - vba

We're developing a PowerPoint plugin, recently we got a requirement from our client to start certain functionality after animation on an object is completed but I'm not able to find any animation finished or started events.

As PeterT has mentioned, there are no events fired when shapes animate. But here's a possible workaround. It may or may not fit your needs:
Add a shape the size of the animated shape, give it a Run Macro Action Setting on mouse-over (not on click). Have it run whatever macro you've written to do what's needed.
Make the shape 99% transparent and animate it to appear automatically after the main shape you've animated.
Result: your original shape animates on, then the (for all intents) invisible add'l shape appears and as soon as the user wiggles the mouse, the macro fires.
If you can't be sure that the user will have the mouse over the shapes in question, try adding a full-slide shape instead to trigger the macro. In that case, to avoid having the macro trigger repeatedly, you might need to have the macro make the shape that triggers it invisible or have the macro remove the action setting or the like.

Related

Animation Resets when Shape Properties are changed in Powerpoint VBA

I have a shape named box1 in my first slide. It has no animations attached to it. However, there are other shapes on the slide that contain lots of trigger animation sequences. If I run the macro ActivePresentation.Slides(1).Shapes("box1").Top = 400 the trigger animation state doesn't change. If I had changed the colour of some other shape via the trigger animation, it stays the same. It is perfect, only the position of box1 changes.
Now, if any animation is attached to box1 and the same macro is played, the animate state of the entire slide resets.
I tried using GetClickCount but that always remained 0 as the animations were all part of trigger sequences. I would appreciate any and all help on this front.
Thank you very much.

How to change an image in MS PowerPoint, when mouse over and out

I need help to change an image when mousing over in PPT.
There are 3 answers on the slide. https://prnt.sc/tzulzc
When mousing over the image to choose the correct answer, I would like to the image change to another image, or just color change so that a user would know he/she can choose it. And then when mousing out again, it gets back to the previous image.
In that case of shape, not image, I could get help in the link below.
https://www.brightcarbon.com/blog/supercharging-powerpoint-interactive-presentations-with-vba-part-2/
But I couldn't get the accurate result since I applied it to the grouped shape.
I did try finding out something online and get nothing.
I hope someone gives me an idea.
Thank you.
MouseOver events only fire once as the pointer moves from NotOverShape to OverShape (I'm making these terms up ... they're not constants or properties, other than conceptually).
The event won't fire when the mouse leaves the shape.
What you can do is add another (100% transparent) shape just behind the real shape you're working with and slightly larger. Now when the mouse moves into the real shape, it'll pass over the "bogus" shape and trigger a mouseover. Likewise, when the mouse moves OUT of the real shape, the same thing will happen.
A mouse-over macro attached to the bogus shape could toggle the value of a global boolean, say InBound. If InBound is true, do {whatever you need to} or if it's false, {undo whatever you've done}.

How to make macros work while in Slide Show mode?

I have a set of grouped images in the PowerPoint slide.
When in Slide Show Mode (full screen) and I hover over these grouped images the slide event needs to take place. Usually when the mouse's slider is slide it ends full screen mode or moves to next slide. Instead I want the mouse slide event to take place. How can I do this in VBA or is there setting in PowerPoint to prevent this?
I'm not sure I understand what you're after, but perhaps this will help:
You can assign any shape (including shapes that are groups of other shapes) an Action Setting (it's on the Insert tab). The Action Setting can be triggered by either a mouse click or ... and this is what you want, I think ... a mouse OVER.
The action can do a variety of things, including trigger a macro (ie, a VBA subroutine in the same presentation file). The macro can receive a reference to the shape that triggered it as well. For example, if you assign this as the macro to run, when you hover over the shape, you'll get a message box with the shape's name:
Sub WhoAmI(oSh as Shape)
MsgBox oSh.Name
End Sub
MouseOver is actually not triggered by the mouse cursor being over the shape so much as by moving from NOT over the shape to being over the shape. Most of the time this distinction isn't important, but if you do a mouseover over a full-slide shape, it won't work.

EaselJS: Changing Shape Color on De-select

(Note: Just to clarify, by "de-select" I mean selecting other shape than the currently selected one, thereby de-selecting the initially selected shape)
Just to elaborate a bit more, I got a series of shapes on a canvas. Any shape I click on changes its color from, say, red to white. But then, there can only be ONE white-colored shape at any given time. That means, if I click on shape-A first then shape-B, shape-A's color must change from white back to red the moment I click on shape-B.
Adding a "click" event listener to every shape was a no-brainer. But, I am at a loss as to how to point back to the previous shape object so that I can restore its original color.
Any help will be much appreciated!
Update: Upon further research, I'm starting to think that my objective boils down to this - Finding a way to point to any Shape object NOT through some event listener but via a method call by passing the object's ID. However, I just checked the Shape class methods here but didn't see anything that might be useful. Could I be missing something here?
(I hope I understood you correctly)
Your "issue" is more of a program-flow issue that is not really specific to a easeljs or any ObjectType.
All you have to do is set a (global) reference to the clicked object inside the click-listener, i'd call it window.lastClickedShape or something similar. And whenever a shape is clicked you check if lastClickedShape != null and reset the color for that object.

Copying shapes between PowerPoint 2007 presentations along with their animations

I programmatically copy the shapes of an entire slide to a new slide in another presentation by performing origShape.Copy and then newSlide.Shapes.Paste().
(copy/paste the entire slide is unfortunately not an option for me here)
My problem is that Animation effects get really warped. Some are lost, others appear in the wrong order.
I thought that maybe after copying all the shapes I'll go over origSlide.TimeLine and will copy each animation effect to newSlide.TimeLine with the corresponding Shapes.
Is there a way of copying Animation effects between shapes without manually setting each and every parameter? (there are LOTS of these).
When copying shape-by-shape to a new slide, naturally the order of the animations gets ruined.
If we had for example the following animation sequence:
Rectangle flying in
Triangle flying in
Rectangle flying out
And we copy first the Rectangle and then the Triangle to a new slide, we'll get first both animations of the rectangle and then of the triangle.
My mistake was trying to solve this disorder by using Shape.AnimationSettings.
BEWARE OF SHAPE.ANIMATIONSETTINGS!!
This Property is kept only for backward compatibility with old versions of PowerPoint. If you modify any of its fields, all animations of a shape except the first one get AUTOMATICALLY ERASED !
So, the solution is this:
Copy shape by shape to new slide (no animations are lost, just mis-ordered). Then use Slide.TimeLine to go over the animation Effects and order them correctly using Effect.MoveTo, or Sequence.Clone and Effect.Delete.