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.
Update: new features
I did some more digging and found out that there are some event in Powerpoint that can be used to start a macro when the slide show starts. So the new version of the PPT automatically starts the timer when the slide show starts and turns it off when the slide show ends. This should be quite convenient. All other features are the same.
I also got a "feature" request which I found quite useful. If you open the VBA editor with Alt+F11 you find some new public constants at the top: timer_week, timer_hour, timer_min, timer_sec. By changing the values from True to False you can turn the individual part of the text on and off. If the timer_week is true, the countdown will show "xx weeks yy days" as opposed to "yy days" when the value is false. The other 3 values are straight forward. Of course it does not make much sense to turn off the hours and keep the minute and second, but you can turn all 3 off, or just the second so there is less information on the slide.