PC Review


Reply
Thread Tools Rate Thread

Can't stop a clock

 
 
NDBC
Guest
Posts: n/a
 
      4th Jul 2009
I have a clock on a userform that shows the time since the race started (now
- start time). The clock works fine but I would like to be able to stop the
clock.

This is the code that runs the clock

In the userform1 section

Private Sub UserForm_Activate()
RClock1
End Sub

And in the module1 section

Sub Main()
Load UserForm1
UserForm1.Show
End Sub

Sub RClock1()
Start = Sheets("Timing Sheet").Range("B6")
Watch = Now - Start
UserForm1.RaceClock1.Text = Format(Watch, "hh:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "RClock1"
End Sub


I tried to write code to stop the clock from a command button (Exit1). This
is it.

In userform1 section

Private Sub Exit1_Click()
Call StopC
End Sub

In the module1 section

Sub StopC()
On Error Resume Next
Application.OnTime NextTick, "RClock1", , False
End Sub


Does not work. I'm assuming the fact that the clock function is working with
spreadsheets is causing me hassles. Anybody got a better way. Thanks.
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      4th Jul 2009

Check your other post.

NDBC wrote:
>
> I have a clock on a userform that shows the time since the race started (now
> - start time). The clock works fine but I would like to be able to stop the
> clock.
>
> This is the code that runs the clock
>
> In the userform1 section
>
> Private Sub UserForm_Activate()
> RClock1
> End Sub
>
> And in the module1 section
>
> Sub Main()
> Load UserForm1
> UserForm1.Show
> End Sub
>
> Sub RClock1()
> Start = Sheets("Timing Sheet").Range("B6")
> Watch = Now - Start
> UserForm1.RaceClock1.Text = Format(Watch, "hh:mm:ss")
> NextTick = Now + TimeValue("00:00:01")
> Application.OnTime NextTick, "RClock1"
> End Sub
>
> I tried to write code to stop the clock from a command button (Exit1). This
> is it.
>
> In userform1 section
>
> Private Sub Exit1_Click()
> Call StopC
> End Sub
>
> In the module1 section
>
> Sub StopC()
> On Error Resume Next
> Application.OnTime NextTick, "RClock1", , False
> End Sub
>
> Does not work. I'm assuming the fact that the clock function is working with
> spreadsheets is causing me hassles. Anybody got a better way. Thanks.


--

Dave Peterson
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't Stop the clock NDBC Microsoft Excel Misc 2 4th Jul 2009 01:36 AM
Stop the clock J.W. Aldridge Microsoft Excel Programming 1 10th Feb 2009 10:16 PM
why does my clock stop during the screen saver? =?Utf-8?B?YmxvbmRpZWJsdWUyMjc=?= Windows XP Help 5 24th Jan 2007 12:24 AM
Start Clock/Stop Clock =?Utf-8?B?YWJmYWJyb2I=?= Microsoft Excel Misc 9 28th Jun 2005 04:26 PM
is there a stop watch/clock utility in ppt for better management . =?Utf-8?B?c2FuZHk=?= Microsoft Powerpoint 1 24th Oct 2004 05:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:28 PM.