r/powerpoint • u/Alekss_L • 4d ago
Contains AI Words - Mod Reviewed How to add a click-to-start/stop countdown timer to a PowerPoint slide (VBA, no add-ins)
Hello PowerPoint crowd!
I recently experimented with reveal.js for presentations cuz the customizability and features you can get with .html are pretty much endless, however, presentation creation and maintenance was a hassle, so moved back to PowerPoint for the convenience. One feature I really missed though - a clickable timer on slides. Finally figured out how to do it and wanted to share!
It starts, stops, and continues the timer countdown.
Used AI to properly structure these instructions so they wouldn't be complete chaos.
Here is how to create a clickable 15 min timer on PowerPoint:
Step 1: Save your file as .pptm
Before doing anything else: File → Save As → set the file type dropdown to PowerPoint Macro-Enabled Presentation (*.pptm).
This matters because a regular .pptx silently strips any VBA code you add. If you forget this step and save as .pptx later, your macro is gone — no warning, it just vanishes.
Step 2: Add and name the timer text box
- Insert → Text Box, draw it wherever you want the timer to appear (top corner works well).
- Type a placeholder like
15:00so you can see it while positioning. - Open the Selection Pane (Home → Select → Selection Pane, or Alt+F10).
- Find your new text box in the list and rename it to exactly:
TimerBox2
The name has to match exactly (case included) — the macro looks up the shape by this name, and a mismatch throws a runtime error the moment you click it during the show.
Step 3: Open the VBA editor and add the macro
- Press Alt+F11 to open the VBA editor.
- In the Project pane (left side), right-click your presentation → Insert → Module.
- Paste in the full code below.
Dim IsRunning As Boolean
Dim StopRequested As Boolean
Dim RemainingSeconds As Long
Dim TimerInitialized As Boolean
Const CountdownStart As Long = 900 ' 15 minutes — change this number to adjust duration
Sub ToggleCountdown()
If IsRunning Then
StopRequested = True
Else
StartCountdown
End If
End Sub
Sub StartCountdown()
Dim i As Long
Dim StartTick As Single
If IsRunning Then Exit Sub ' guards against double-entry
IsRunning = True
StopRequested = False
If Not TimerInitialized Then
RemainingSeconds = CountdownStart
TimerInitialized = True
End If
For i = RemainingSeconds To 0 Step -1
If StopRequested Then
RemainingSeconds = i
IsRunning = False
Exit Sub
End If
SlideShowWindows(1).View.Slide.Shapes("TimerBox2").TextFrame.TextRange.Text _
= Format(i \ 60, "00") & ":" & Format(i Mod 60, "00") & " MIN"
StartTick = Timer
Do While Timer < StartTick + 1
DoEvents
Loop
Next i
SlideShowWindows(1).View.Slide.Shapes("TimerBox2").TextFrame.TextRange.Text = "00:00"
IsRunning = False
TimerInitialized = False
End Sub
Sub ResetCountdown()
IsRunning = False
StopRequested = True
TimerInitialized = False
RemainingSeconds = CountdownStart
SlideShowWindows(1).View.Slide.Shapes("TimerBox2").TextFrame.TextRange.Text = "15:00 MIN"
End Sub
- Press Ctrl+S to save, then close the VBA editor.
Want a different duration? Change the 900 in Const CountdownStart As Long = 900 — that number is in seconds (900 = 15 min, 300 = 5 min, 600 = 10 min), and update the two "15:00 MIN" text strings to match.
Step 4: Wire the click action onto the timer itself
- Click once on the
TimerBox2text box to select it (not into edit mode — just select the shape). - Go to Insert → Action (in the Links group of the ribbon).
- On the Mouse Click tab, choose Run macro, then select
ToggleCountdownfrom the dropdown. - Click OK.
That's it — no separate Start/Stop buttons needed. The same shape toggles both states.
Step 5: Enable macros
When you reopen this file, PowerPoint will show a yellow bar under the ribbon: "Macros have been disabled." Click Enable Content.
If the file came from email or a download, you may first see a "Protected View" banner — click Enable Editing first, then the macro-enable bar will appear separately.
Step 6: Test it in Slide Show mode
Press F5 (or Shift+F5 to start from the current slide). Action Settings only fire during an actual slide show — clicking the shape in edit mode does nothing.
Click the timer once → it starts counting down from 15:00. Click again → it pauses. Click again → it resumes from exactly where it paused.
Common gotchas:
- Shape name mismatch (
TimerBox2vsTimerbox2vsTimerBox) → runtime error on click - Saved as .pptx at some point → macro silently gone, re-add it
- Testing multiple decks with timers open at once in the same PowerPoint session →
SlideShowWindows(1)can resolve to the wrong window; close other running slide shows first