Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Timer on Userform

Hi All
I have a UserForm on which I wish to start a timer and display the time by
the second, until another event stops it.

Currently I store the time in a variable as the first event fires, then
subtract that from the time when the second event fires, that is OK and
gives me total time, but does not lend itself to be displayed on the
UserForm.

Any ideas?


--

Regards,
Nigel




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Timer on Userform

Paste this in to your userform module...

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub UserForm_Activate()
DoEvents
Sleep 3000 ' Time in milliseconds
Unload Me
End Sub

Assign youruserformname.show to whatever event you want

"Nigel" wrote:

Hi All
I have a UserForm on which I wish to start a timer and display the time by
the second, until another event stops it.

Currently I store the time in a variable as the first event fires, then
subtract that from the time when the second event fires, that is OK and
gives me total time, but does not lend itself to be displayed on the
UserForm.

Any ideas?


--

Regards,
Nigel





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Timer on Userform

That is interesting but not entirely what I need. Is it not the case that
the Sleep function halts the processing for the selected time?

The form needs to show the time incrementing by the second from 00:00:00,
until another event (control on the form is clicked for example). All other
functionality needs to remain 'live' whilst the countdown continues in the
background.


--

Regards,
Nigel




"Office_Novice" wrote in message
...
Paste this in to your userform module...

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub UserForm_Activate()
DoEvents
Sleep 3000 ' Time in milliseconds
Unload Me
End Sub

Assign youruserformname.show to whatever event you want

"Nigel" wrote:

Hi All
I have a UserForm on which I wish to start a timer and display the time
by
the second, until another event stops it.

Currently I store the time in a variable as the first event fires, then
subtract that from the time when the second event fires, that is OK and
gives me total time, but does not lend itself to be displayed on the
UserForm.

Any ideas?


--

Regards,
Nigel






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Timer Vijay Excel Worksheet Functions 1 April 6th 07 11:00 AM
Timer Steve Excel Programming 4 June 13th 06 02:23 PM
Stopping a Timer / Running a timer simultaneously on Excel Paul23 Excel Discussion (Misc queries) 1 March 10th 06 12:08 PM
timer Mike Macgowan Excel Programming 4 May 24th 05 03:27 AM
Timer RK[_3_] Excel Programming 2 April 5th 04 06:03 AM


All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"