Timer on Userform

N

Nigel

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?
 
O

Office_Novice

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
 
N

Nigel

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
(e-mail address removed)
 

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