monkeymafia
New Member
- Joined
- Sep 22, 2009
- Messages
- 2
Hi all,
I have a simple stopwatch program which i've created in excel, with a start, stop and save button. does anybody know how I would go about making a pause button work. So when the pause button is pressed the timer can be resumed by pressing the start button.
This is my code:
I have a simple stopwatch program which i've created in excel, with a start, stop and save button. does anybody know how I would go about making a pause button work. So when the pause button is pressed the timer can be resumed by pressing the start button.
This is my code:
Code:
Dim CmdStop As Boolean
Dim PauseTime, Start, Finish, TotalTime
Sub Btn1_Click()
CmdStop = 0
If (MsgBox("Press Yes to pause for 5 seconds", 4)) = vbYes Then
PauseTime = 5 ' Set duration.
Start = Timer ' Set start time.
Do While CmdStop = 0
TimerValue = Timer - Start
DoEvents ' Yield to other processes.
Loop
Finish = Timer ' Set end time.
TotalTime = Finish - Start ' Calculate total time.
MsgBox "Paused for " & TotalTime & " seconds"
Else
End
End If
End Sub
Private Sub btnPause_Click()
???
End Sub
Private Sub BtnReset_Click()
TimerValue = 0
End Sub
Sub BtnStop_Click()
CmdStop = 1
End Sub