PDA

View Full Version : VBA Timer Not Working Suddenly



Kellaroo
06-21-2023, 10:44 PM
Hello All! Recently the standard timer that I use in many PPTs has suddenly stopped working. The time does not update on the screen (Within the "Timer" object) and the conditional does not happen at the end. It only seems to update when I constantly cursor over the screen, or click around. However, the code will function somewhat in a new, clean Powerpoint.

So... What other elements could be affecting this code? What would cause it to lag, or not update? Why would it suddenly stop working (I've used it for over a year)?
I can't figure it out :doh: Any theories would be greatly appreciated!



Sub Timer ()

Dim time As Date
time = Now()
Dim countdown As Integer
countdown = 5
time = DateAdd("s", countdown, time)
Do Until time < Now()
DoEvents
ActivePresentation.Slides(1).Shapes("Timer").TextFrame.TextRange = Format((time - Now()), "hh:mm:ss")
Loop
If time < Now() Then
* DO THE THING *
End If

End Sub