I was asked to do a countdown timer in Powerpoint that would show the number of days, hours, minutes and seconds left to a go live date. I looked around and found quite few examples. Most of them just simple count downs from 5-4-3-2-1 that was achieved using animation. It was clear that I need VBA code to make it happen.
There is an update of this article for PowerPoint 2010 at the end of this article. Read it if you have this - or newer - version PPT.
Finally I came up with this. It is a piece of code which gets activated when the user clicks on the "timer" shape on the cover page. Than it shows the remaining time on ever single page of the presentation.
Unfortunately there are a few restrictions in Powerpoint and also differences between PPT 2003 and 2007 onwards. First of all, there are no in-built events, so I cannot make the timer to start automatically. There is a possibility to install plugins, but than it would only work on the computer where the plugin is installed and quite frankly does not worth the effort. Secondly it is not possible to name objects in PPT 2003. When you create a new shape (circle, rectangle) it gets named automatically (Circle 1, Rectangle 1) and you cannot change the name of it. You can in PPT 2007. Therefore it is difficult for the code to identify where to print countdown. So what I have done that the code finds the last shape on each page and updates the text of that shape with the timer text.
Let's see how it works, and how to make your own go live timer.
Download and open the sample presentation above. Also open your presentation where you want to include the timer. Now open the Visual Basic editor. It is in menu Tools / Macro / Visual Basic Editor, or Alt+F11 for short. On the left you see my sample and your presentation. Right click on your presentation and from the pop-up menu select, Insert, Module as below:
Now you will see Modules / Module1 in your presentation as well. Double click on Module1 on the sample document and copy all the code to Module1 of your presentation. Scroll to the top of the code and find the following line:
Public Const TargetDateTime As Date = "20/10/2012 15:17:00"
This is where you set the target date. Keep the DD/MM/YYYY HH:MM:SS format. This is all the coding that is required.
Let's assume that your presentation is now complete (all text, image, chart, etc. added). Add a shape to each page where you want the countdown text to appear. Make sure that the shape is long enough or wrapping is turned on for the textbox inside the shape. Now there is one last step to do.
Assuming that you have a timer on the front page, select that shape (or any other shape which you want to be the "ON/OFF" switch for the timer), right click and select Action Settings. In the new window, select "Run Macro" option and select "TimerOnOff" from the dropdown.
Save your file and start the presentation. Once you click on the shape (one you assigned the action to) the timer will start and will update the text every second on every single page of the presentation. The macro continues to count down when you leave the presentation mode and back to editing.
Update for PowerPoint 2010:
As mentioned above, in PowerPoint 2010 and onwards, there is a possibility to rename objects in presentation. Therefore the macro can update only those boxes which can be anywhere in the presentation (on any slide). To rename boxes, to to the Home ribbon (menu), In the Drawing section there is a Arrange dropdown. Click there and select Selection Pane... This opens a new window on the side. Select the box which you want the countdown to be displayed in. Double click the name in the Selection Pane (e.g. Rectangle 171) and rename it to "TimerBox".
The modified PPT file also has a minor code change to only update the shapes with name TimerBox.