Adding a timer to PP using VBA

  • Thread starter Thread starter BryanM
  • Start date Start date
B

BryanM

Hi everyone,

I am trying to add a timer to my presentation. I have set up a quiz in
pp and I want the quiz to record how long it takes the user to complete
the quiz. I would like for the timer to start and stop at certain
pages and then display the time along with the score. I have been
searching to no avail on how to actually accomplish this. I was hoping
someone may have a sugggestion or code they have used.

Thank you,

Bryan
 
Hi,

Vba is not really my area, but...

This outline clock methods:

Clocks and timers for PowerPoint
http://www.pptfaq.com/FAQ00081.htm


And this one on keeping score:

Keep Score with Static Variables
http://www.pptfaq.com/FAQ00583.htm


--

Regards,

Glen Millar
Microsoft PPT MVP

Tutorials and PowerPoint animations at
www.pptworkbench.com

glen at pptworkbench dot com

Please tell us your PowerPoint / Windows version,
whether you are using vba, or
anything else relevant
 
With a little refinement, something like this should work:

Dim totalTime As Long
Dim startTime As Long
Dim endTime As Long
Dim counting As Boolean

Sub Initialize()
totalTime = 0
counting = False
End Sub

Sub StartTiming()
startTime = Timer
counting = True
While counting
DoEvents
ActivePresentation.Slides(1).Shapes(5).TextFrame.TextRange.Text =
_
Int(totalTime + (Timer - startTime))
Wend
End Sub

Sub EndTiming()
endTime = Timer
counting = False
totalTime = totalTime + (endTime - startTime)
End Sub

Sub DisplayTime()
MsgBox "You took " & totalTime & " seconds to finish."
End Sub


--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
David,

Thanks so much for the quick response. I played around with the code
and got it to do almost exactly what I wanted it to. The one thing
that I would like to change however, is having the time displayed in
minutes and seconds (not just seconds as it is now) at the end when
they (participants) display their time and score. Is this possible?


Once again thank you,

Bryan
 
Back
Top