Pictures in PowerPoint can be tricky to get to grips with. Choosing the right size has an impact on both the file size of your presentation and the maximum monitor/projection size you can use without degrading quality.
PowerPoint has evolved into an app which is the Swiss Army knife of content creation, not only for presentations but also printed collaterals, videos and even interactive presentations.
In this second part of our series on supercharging PowerPoint interactive presentations with VBA we look at how you can provide your users with visual feedback for active areas of your slide using a mouse hover technique.
In part 1 you learned how you can add links to objects on slides that, when clicked, take the user to a different slide. But how does the user know that the object you’ve created the link for is an active object on your slide? In other words, how do they know it is clickable?
Good design plays an important part here. If you look at the slide below, it’s fairly obvious that the items in the left hand menu might do something:
However, in the next example, it’s not immediately clear that the three icons, or their corresponding text boxes link to other parts of the presentation:
You can add built-in PowerPoint visual feedback for the user by selecting the linked object and clicking the Insert tab in PowerPoint. Then, in the Links group click the Action button. As you discovered in Part 1, this opens the window below where you can set up your desired link in the Mouse Click tab. For the visual feedback you click the second Mouse Over tab and check the Highlight when mouse over option:
Now when you hover your mouse over the active area in slide show mode you can see which content elements are active:
In the example above, the mouse is hovered over the icon of the ship. Can you tell it’s an active object with a hyperlink? That very faint green dotted line is what PowerPoint uses by default. It’s not very clear at all is it? You might even say it’s pretty ugly! Not what you want for your interactive presentations.
You can do much better with VBA
VBA: Highlighting active objects in interactive presentations
You can use our custom VBA macro to do something much smarter:
Public Sub GraphicHover(ByRef oGraphic As Shape) oGraphic.Fill.ForeColor.ObjectThemeColor = msoThemeColorAccent1 End Sub
You can probably work out that this macro changes the fill colour of the object (called a Shape in VBA) to Accent 1 from the theme. Once you’ve added this to your PowerPoint file (read this to find out how) then you can uncheck the PowerPoint highlighting feature and instead assign the Mouse Over event to Run macro, selecting the GraphicHover macro:
Now when you move the mouse over the icon during a slide show the fill colour changes:
But as you can see at the end of the video there’s a major problem. When you move away from the icon, it doesn’t return to its original state.
What you need here is a Mouse Out event in the Actions window.
Spoiler alert, it’s not there! But don’t worry, with some out-of-the-box thinking there’s a clever hack to overcome this. What you need to do is to create an invisible shape which resets the hover state of the icon as you hover over this invisible shape. Here are the steps to create your invisible shape:
- First make sure you’re using a shape for the icon that can be filled e.g. an SVG icon or a PowerPoint vector shape (a PNG/JPG picture won’t work)
- Add our ResetGraphicHover macro from the code snippet below to your PowerPoint VBA project (read this to find out how)
- Insert a rectangle, sized and positioned to cover the whole slide
- From the Insert tab, click the Action button and set the Mouse Over event on the rectangle to run our macro ResetGraphicHover
- Right-click the rectangle and then click Format Shape…
- In the Format Shape pane, set the Fill / Transparency slider to 100% (don’t set it to No fill) and set the Line to No Line
- Send it to the back by clicking the Home tab followed by Arrange and Send to Back
Tip: to prevent this rectangle from getting deleted, moved or interfering with the editing of your slide, you can create it on a slide master layout instead.
Here’s the code for the reset hover macro:
Public Sub ResetGraphicHover(ByRef oCover As Shape) Dim oSld As Slide Dim oShp As Shape Set oSld = oCover.Parent For Each oShp In oSld.Shapes With oShp.Fill.ForeColor If .ObjectThemeColor = msoThemeColorAccent1 Then .ObjectThemeColor = msoThemeColorDark1 End With Next End Sub
Now when you run the interactive presentation, the icon fill colour changes as you hover over it and resets when you hover away from it, triggered as you hover over the invisible cover shape:
That’s much clearer visual feedback. You can go further and set all sorts of other properties in the hover and reset macros such as outline colour, transparency, line weights and so on:
Now that you know how to use VBA when creating interactive presentations, check out my post on restoring default slide master layouts with VBA or discover our Click-and-Explore service to find out how we can help create beautifully-designed interactive presentations for you.Leave a comment
Senior technical consultantView Jamie Garroch's profile
How do you make sure the presentations, spreadsheets and documents your create in Microsoft Office are kept in line with your brand? Learn how to create, save and deploy a custom Office theme across PowerPoint, Excel and Word.
Thank you so much for conducting our advanced PowerPoint training workshop. We will definitely use BrightCarbon in the future – we really think that we would be hard pressed to find anywhere better!Emma Pring Iona Capital