• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Help : VBA code to show Running system click on Userform

Mahantesh

Member
Hi All,

I need a vba code to show running digital system time on my Userform. Below is my code which is just showing time and not changing any seconds incremental.

Please help:
-----------------------
Sub show_clock()
UserForm1.Label14.Caption = Time

Application.OnTime Now + TimeValue("00:00:01"), procedure:="show_clock"

End Sub

Private Sub UserForm_Initialize()
Call show_clock
UserForm1.Repaint
End Sub

Thanks & Regards,
Mahantesh
 
Hi Chihiro,

I tried but the label shows just static time and not changing by every second.

do u have any other piece code?

I tried almost every webs' code.

Please help!

Regards,
Mahantesh
 
Hmm? Did you follow the instruction given in the link?
It works fine. Though I normally don't see the point of showing clock on userforms. I just use time stamps instead.

See attached.
 

Attachments

  • RunningClock.xlsb
    17.8 KB · Views: 91
Chihiro,

Do you have any example where u have used command Button on the Userform itself instead of worksheet. I have created userform where i want to show running clock top left corner. I wrote the code(BTW, not executing), in Userform1.Initialize() so that i can show the running clock on the form all time.

Sorry for complexity!

Regards,
Mahantesh
 
Hmm? Worksheet is just used to house command button to launch the userform.

Note that you need both "Private Sub UserForm_Initialize()" and "Private Sub UserForm_Terminate()" as well as regular module with "
Sub Live_time()"

Basically, Private Subs call on Public Sub "Live_time" when userform is initialized (launched) and when it's terminated. Application.OnTime is used to make it tick every second.
 
Back
Top