View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default live time on userform or within frame

Here is an example based upon a label on the form to show the time, and two
buttons, one to start it, one to stop it.

This is the userform code

Private Sub CommandButton1_Click()
DisplayTime
End Sub

Private Sub CommandButton2_Click()
Application.OnTime nTime, "DisplayTime", , False
End Sub

and in a standrad code module

Public nTime As Double

Sub DisplayTime()
UserForm1.Label1 = Format(Now(), "dd mmm yyyy hh:mm:ss")
nTime = Now() + TimeSerial(0, 0, 1)
Application.OnTime nTime, "DisplayTime"
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"T.c.Goosen1977"
wrote in
message news:T.c.Goosen1977.2ah4ap_1152105008.604@excelfor um-nospam.com...

Its easy to display the date and time in a userform but is it possible
to have the time, seconds, running live in the userform or frame...or
is it just the case of refreshing the update within the
frame/userform......mmm but how?

Thanks Theuns


--
T.c.Goosen1977
------------------------------------------------------------------------
T.c.Goosen1977's Profile:

http://www.excelforum.com/member.php...o&userid=35895
View this thread: http://www.excelforum.com/showthread...hreadid=558411