Adjust my countodwn

P

Preschool Mike

Is it possible to adjust the following code so the countdown displays in a
clock format (e.g., 2:00 for two minutes). It currently displays one minutes
as 60 , two minutes as 120 and so on.

Public StopNow As Boolean
Dim GameTime As Integer
Dim userName As String

Sub EnterTime()
YourName 'player enters their name
GameTime = InputBox("Set the game time") ' player enters amount of time they
think they can beat the game. Currently entered as 60 for one minute.
ActivePresentation.SlideShowWindow.View.Next
CountDown 'countdown starts
End Sub

Sub Wait(waitTime As Long)
Dim start As Double
start = Timer
While Timer < start + waitTime

If StopNow Then
Exit Sub
Else
DoEvents
End If
Wend
End Sub

Sub CountDown()

Dim X As Long
StopNow = False

For X = GameTime To 0 Step -1

If Not StopNow Then

ActivePresentation.SlideMaster.Shapes("Timebox").TextFrame.TextRange.Text =
CStr(X)

Wait (1)
End If
Next

If Not StopNow Then
MsgBox ("You're out of time!")
End If
End Sub
 
J

John Wilson

See if this works

Sub CountDown()
Dim dText As Date
Dim X As Long
StopNow = False
GameTime = 129
For X = GameTime To 0 Step -1

If Not StopNow Then
dText = CDate(X \ 3600 & ":" & _
((X Mod 3600) \ 60) & ":" & (X Mod 60))
ActivePresentation.SlideMaster.Shapes("Timebox") _
..TextFrame.TextRange.Text = Format(dText, "Nn:Ss")
Wait (1)
End If
Next

If Not StopNow Then
MsgBox ("You're out of time!")
End If
End Sub
 
P

Preschool Mike

I appreciate your help, but I really don't know how to use this function.
How do I set my game time (input game time)? How do I get it to countdown?
How do I get it to display the countdown in my ("Timebox")?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top