Header
PowerPoint tips, hints and tutorials that will change your presentations for ever!

INDEX

 

Jigsaws
Sounds
Video
Custom Shows
vba code
NaviSlides
Games for teachers
Bullets
Triggers
Security
Flash Cards
Multiple Instances
PowerPoint 2007
Mail Merge
Random events
Animation
Hyperlinks
Set spellcheck language


Home buttonTutorial buttonContact buttonProducts button

Countdown To An Event

This is a common request a- a looping PPT presentation that countd do wn to an event. Not easy to achieve though! This is a project for those used to vba it might not be suitable for beginners!

Here's how to do it with some vba code.

You need to start with a one slide presentation set to loop and with an auto transition of about 1 second.

Make sure the first slide has a title placeholder and adjust the format as required.

Next add the code.

Press ALT f11 to open the code editor. INSERT a mdule.

module insert

Paste this code into the module. Obviously change the target date in the code ("1/29/2022 2.59 PM) to suit your needs.

Sub testme()
Dim diff As Long
Dim ww As Long
Dim dd As Long
Dim mm As Long
Dim hh As Long
Dim ss As Long
diff = DateDiff("s", Now, "1/29/2022 2:59 PM")
ww = Int(diff \ 604800)
overflow = diff Mod 604800
dd = Int(overflow / 86400)
overflow = overflow Mod 86400
hh = Int(overflow / 3600)
overflow = overflow Mod 3600
mm = Int(overflow / 60)
ss = overflow Mod 60
ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange = Format(ww, "00") & " weeks " & Format(dd, "00") & " days " & Format(hh, "00") & " hours " & Format(mm, "00") & " minutes " & Format(ss, "00") & " seconds "
End Sub


This code creates the time left. Now the much more difficult task is making it update every second.

Go back to the code editor and ADD this code too

Sub onSlideShowPageChange(SW As SlideShowWindow)
Call testme
End Sub


This is old code from earlier versions but it can still work updating the time everytime the show loops. To make this more reliable simply add an item (e.g. command button from the ActivX toolbox. You can set this to invisible in the selection pane. Set a loop by giving the slide an AUTO transion of 1 second and set the show to Loop until ESC in slide show settings.

Run the show!
 

 

Back to the Index Page

POWERPOINT BLOG

Articles on your favourite sport

Free Microsoft PowerPoint Advice, help and tutorials, Template Links
This website is sponsored by Technology Trish Ltd
© Technology Trish 2007
Registered in England and Wales No.5780175
PowerPoint® is a registered trademark of the Microsoft Corporation