Mouse Over Animation In PowerPoint

Published on
10,057 Points
3 Endorsements
Last Modified:


In all recent versions of PowerPoint it is possible to trigger animations. This means the animation takes place when a certain shape is clicked. This allows you to run animation “on demand” and outwith the normal sequence of mouse clicks.

There is no obvious way to run an animation when a shape is just “moused over” rather than clicked. This is a common feature in web pages but not available in PowerPoint. A typical use might be to show a map or definition when an item is “moused over” and remove it again later.


Trigger Animations

Let’s start by creating a triggered animation.  
MO1.jpgLook at the screen shot. If the text has a fade animation and a fade exit in PowerPoint it will currently appear on the first click and fade away on the second. The desired behaviour is it will fade in on the first click ON THE TRIGGER SHAPE and out again on a second click of the shape.

To achieve this open the animation pane. Select both the fade in AND fade out entries (hold down CTRL) and set a trigger of the rectangle from the ribbon as shown. If you have an earlier version of PowerPoint you can use the drop arrow (circled) to choose TIMING and set the trigger here.
mOTrigger.jpgWhen you run the slide show ("DEMO1.pptx") you should find that the text fades in when the button is pressed and out again on a second press.
So far, so good but how to make this happen on mouseover?

A Trick

A useful trick you may not know is essential to getting mouse over animation to work. Run the slide show again but this time press TAB and then ENTER. The animations take place, as if you had clicked the shape.

Press The Keys On Mouse Over

It is possible to trigger a macro on Mouseover. Select the train image and Insert Action.
 Open the Visual Basic Editor (ALT + f11).
Insert a module and paste in this simple code.
Sub anim(oshp As Shape)
Dim osld As Slide
Set osld = oshp.Parent
'Note alter the name here to match the trigger shape
If osld.Shapes("Rectangle 7").ZOrderPosition = 1 Then
SendKeys ("{TAB}")
SendKeys ("{ENTER}")
osld.Shapes("Rectangle 7").ZOrder (msoSendToBack)
End If
End Sub

Open in new window

Give the picture a mouseover action of Run Macro

Most programmers hate using SENDKEYS but it is the only simple way to do this.
Finally if you don’t want to see the blue trigger shape in the show you can move it off slide where in will never be visible.
Text the sample DEMO1_code.pptm file.


Since the image now also has an action you need to be sure that TAB ENTER activates the trigger button and not the macro or you will get into a code loop. To do this make sure the button is sent to the back. TAB ENTER will always activate the first shape with an action. This is why the code checks that the trigger shape is at the back and moves it if necessary.


This is the demo file without code.

You may download a fully working example here. Note it is in .ppt format as Experts Exchange does not yet support uploaded  .pptm files. Make sure you have macros and editing enabled when you try it.
  • 2
  • 2
LVL 23

Author Comment

Hi eric

I have changed the text to indicate the animations are in the PowerPoint file. I have attached the two demo files. I was unable to do this at first as EE rejects the upload of pptm files.

Expert Comment

by:Karlo R
First of all, I'd like to thank you for sharing this! I've been Googling for ways to make mouse overs trigger an animation and just stumbled on this yesterday!
I've been looking for something like this because I didn't want to duplicate slides that mimic the effect of pop ups, etc.

I know that I shouldn't try to make fancy presentations but I just can't help trying to make interesting effects:
I have a list of text hyperlinks and I want it so that a cursor appears to the left of the text (or maybe a glowing version of the same text) only when I hover my mouse on to it. Also, a Callout appears with a short trivia about the text that's being highlighted.
But as soon as I move the mouse off it, the cursor and the callout automatically disappears.

I managed to make it work using your macro (I don't have any experience with "macros" prior to finding this guide) by having an image in the background serve as the trigger for the disappear animation.

But there's one problem though, as soon as those images disappear when I hover off the text hyperlinks (hover over the disappear trigger in the background), I always have to hover over the "Appear triggers" twice before the cursor and Callouts appear.

Is this

Expert Comment

by:Karlo R
Continued above:

But there's one problem though, as soon as those images disappear when I hover off the text hyperlinks (hover over the disappear trigger in the background), I always have to hover over the "Appear triggers" twice before the cursor and Callouts appear again.

It appears right away the first time I hover on the appear trigger but when I make it disappear, I always need to hover off and on twice before I can get it to show once more.

Is this some sort of a limitation of macros?
LVL 23

Author Comment

The macro is really just pressing the trigger button. You would need to modify the ANIMATIONS to get what you need. Not that simple but certainly possible,

Simple demo here

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Join & Write a Comment

This video teaches viewers how to create handouts from their slides and helps them decide how many slides to include per handout.
The viewer will learn how to edit animations within the presentation, incorporate sound, and set everything up with timing.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month