Embed and Open Tableau Workbooks in PowerPoint

A follow up post: how to embed a Tableau Packaged Workbook in PowerPoint and open it directly within the Slide Show

Woman Aircraft Worker / Photographer: David Bransby (flickr.com)Yesterday’s post Embed Tableau Visualizations in PowerPoint described three stand-alone alternatives (i.e. without the use of an add-in) to Andy Kriebel’s great post on how to embed a Tableau dashboard in PowerPoint.

Both Andy and I used the word “embed” in the titles of our posts. Truth be told, this is a little exaggeration. Using a web browser control object navigating to a Tableau workbook stored on a server like Tableau Public is not really embedding the workbook. The main disadvantage of those approaches is the fact that you can interact with the Tableau dashboards, but you are not able to edit the workbook. Let’s assume you are receiving a question during your presentation which cannot be answered with your existing views and dashboards: You are not able to add another sheet and do some extra data analysis and new visualizations on the fly. In other words, you are losing one of Tableau’s greatest advantages: rapid fire data analysis and Business Intelligence.

Of course you can physically embed the Tableau workbook in your PowerPoint presentation as an object like you can do with any other file of any other application. However, there is one main pitfall: PowerPoint does not allow you to open an embedded object during the slide show. You always have to interrupt the presentation, go back to the normal view in PowerPoint and open the file from there. Honestly, this is not much better than simply opening the file from the Windows explorer and it is far from being a seamless experience for the audience of your presentation.

So, here is today’s challenge: embed a full packaged workbook into PowerPoint and provide a way to open it directly during the slide show.

The step-by-step tutorial

Step 1: The PowerPoint File

Open an existing PowerPoint presentation or create a new one, insert a new slide (layout title only or blank) and save it as a PowerPoint Macro-Enabled Presentation.

Step 2: Embed the Tableau Packaged Workbook

On the Insert Tab of PowerPoint click on Object, Create from File, browse to the Tableau Packaged Workbook and click Ok:

Insert Tableau Workbook

Go back to the Home Tab, click on Select and Selection Pane and rename the generic object name (e.g. “Object1”) to “TableauWorkbook”. This is optional and you can change this to whatever you want, but a clear name will help us to refer to the object in the VBA (see the code in step 4).

Step 3: Insert an Image exported from your Tableau Workbook

This is an optional step, but from my point of view it looks best if you have a static image of one of your dashboards in your PowerPoint presentation and open Tableau by clicking on this image.

First you have to create the image. Nothing new under the sun, you certainly know how to do this. Open your Tableau workbook, go to the dashboard and in the main menu click on Dashboard|Export Image and select JPEG as the file format.

Next, go back to PowerPoint, click on the Developer Tab and on Image (ActiveX control):Insert Image ActiveX ControlRight click on the inserted ActiveX Image control on your slide, select Properties, go to the property Picture, click on the three dots at the right and browse to the image.

Image Properties

You should see something like this now:

Inserted Dashboard Image

Step 4: The VBA

Double click on the image. PowerPoint will automatically take you to the VBE (Visual Basic Editor) and already inserted a sub called Image1_Click:

VBE - Image1_ClickDelete the existing code and replace it by this code:

Option Explicit

Private Sub Image1_Click()
Dim intCurrentSlide As Integer
    On Error Resume Next
    ‘ Store the current slide index
    intCurrentSlide = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex
    ‘ Exit the Slide Show
    ActivePresentation.SlideShowWindow.View.Exit
    ‘ Minimize the PowerPoint Window
    Application.ActiveWindow.WindowState = ppWindowMinimized
    ‘Open the embedded Tableau Workbook
    Shapes(“TableauWorkbook”).OLEFormat.DoVerb 1
    ‘ Restart the Slide Show
    ActivePresentation.SlideShowSettings.Run
    ‘ Navigate to the current slide
    ActivePresentation.SlideShowWindow.View.GotoSlide intCurrentSlide
End Sub

The code will be executed if you click on the image during the slide show. It will exit the slide show, open the Tableau workbook and restart the slide show on the same slide st the same time.

I can’t tell you no lies: you will see some flickering of the screen, but from my point of view this is an acceptable disadvantage. For those among you working with VBA in Excel: this is the case because unlike Excel, PowerPoint has no Application.ScreenUpdating property.

That’s it.

Start your PowerPoint slide show and click on the image. Seamlessly (well almost) Tableau will be opened and you can fully interact with the embedded workbook.

The Download

As a tribute to my friend Richard Leeke and a thank you very much for all he has done with his fabulous guest posts here, on the Equinox Blog and for the Tableau community in general, I decided not to use one of my own workbooks. I rather used the workbook Richard generously provided with his latest blog post, an impressive example of how far you can get with Tableau.

So, here is an example one-page PowerPoint presentation with Richard’s latest workbook showcasing the technique described above:

Download Embed and Open Tableau in PowerPoint (Microsoft PowerPoint 2010, 1,911.6K)

Stay tuned.

Update on June 14, 2012

The technique described above does apparently not work in all cases. If Tableau starts very quickly or the Windows confirmation dialogue to open the Tableau workbook appears, PowerPoint will get the focus again and the slideshow will hide the Tableau window or the opening dialogue.

If you are hitting this issue, you have several options:

Option 1: The brute-force method

The first thing that comes to mind is to interrupt the VBA code before restarting the PowerPoint slideshow. The easiest way of doing this is a VBA message box waiting for a confirmation to restart the slideshow:

Simply insert the following line

MsgBox “Continue Slideshow”

before the line

ActivePresentation.SlideShowSettings.Run

The disadvantage: after you closed Tableau, the slideshow will only start again after you close the message box by clicking “Ok”. Not very elegant and not a seamless experience for the audience, but it works.

Option 2: Reactivate Tableau after restarting the slideshow

Second option is to activate Tableau again after restarting the slideshow using the VBA command AppActivate. Simply add the following line to the end of the VBA sub (i.e. the line before End Sub):

AppActivate “Tableau -“

This VBA command switches to the first occurrence of an application which has a caption starting with “Tableau -“.

The disadvantage: switching back and forth between PowerPoint and Tableau will cause some flickering of the screen.

Option 3: Linking to a Tableau workbook instead of embedding one

The last option is a completely different approach. Instead of embedding a Tableau workbook into PowerPoint, we define the path and filename of the Tableau workbook in a textbox on the slide. The VBA code will then open this workbook in Tableau. To implement this, we need a completely different piece of code using the functions ShellExecute and GetDesktopWindow.

If you are interested, have a look for yourself. Here is the link to a PowerPoint presentation using this approach:

Download Tableau in PPT No Embedding (Microsoft PowerPoint 2010, 890.1K)

Before starting the slideshow make sure you changed the path and filename in the textbox at the bottom left of the slide to fit your needs.

In terms of user experience this is probably the most elegant and seamless solution since there is no need to interrupt and restart the slideshow and thus there is no screen flickering.

However, the workbook is not embedded. If you send the PPT file to someone else, he can only open the workbook if the path and workbook defined in the textbox is available on his computer (e.g. a workbook on a network or internet drive). If you define a path and workbook on your local hard drive it will not work on other computers.

Many thanks to John for the heads-up.

Add a Comment

Your email address will not be published. Required fields are marked *