|PowerPoint tips, hints and tutorials that will change your presentations for ever!|
Mouseover Trigger an Animation With vba Code
We are often asked if this is possible. The usual answer is "NO" - the vba object model has no inbuilt way to do this.
Here's a clever trick that can work though!
It relies on the little known fact that action buttons or shapes can be triggered from the keyboard and of course action buttons and shapes can trigger animation!
Try this out set up an animation triggered buy an action button or shape. If you don't know how to do this read "Triggers a Definitive Guide" first!
Now in show mode press TAB and then ENTER, you should see a dotted line indicating that the button is selected and then the animation run.
Even better if you do not want to see the button simply drag it off slide - it will still work! If there are more than one button you may have to press TAB multiple times to select the correct button.
To get this to work from vba you can use use the SENDKEYS command. We normally avoid this command but I think it's the only way here.
The code to press TAB then ENTER
Now add a shape and give it a MOUSEOVER action of run the code above. Before testing the mouseover make sure that the animation runs OK if you manually press TAB then ENTER. If you add the mouseover shape BEFORE the action button you may find that TAB selects the mouseover shape and not the trigger action button. If this happens try selecting the action button and sending to back.
This can be used to simulate a mouseover trigger.
If you have several triggers simply add more TAB SendKey lines.
For example to simulate Tab Tab Enter to click a second button:
Another Way (not recommended)!
This is only suitable when the slide has NO existing animations
The code needs to:
Here is some typical code
This will work from a userform and you can have several buttons running different animations
Free Microsoft PowerPoint Advice, help and tutorials, Template Links