Update the time in a form caption
I am working on a project using forms in excel. I need to have th
time updated in the caption on the form. So, as each second passes I need to be able to see that. Please help Thank Andre |
Update the time in a form caption
|
Update the time in a form caption
Try this,
Put below code into form's code module. Dim TimeUpdate As Boolean Private Sub UserForm_Activate() TimeUpdate = True Do DoEvents If TimeUpdate Then Me.Caption = Time Else Exit Sub End If Loop End Sub Private Sub UserForm_Terminate() TimeUpdate = False End Sub Regards, Shah Shailesh http://members.lycos.co.uk/shahweb/ (Excel Add-ins) *** Sent via Developersdex http://www.developersdex.com *** |
Update the time in a form caption
you'll need to use a timer control that fires every second. There are quite a
few ActiveX controls that do this .. do a google search.. Updateing the caption is simplistic Private Sub UserForm_Click() UpdateDaption End Sub Sub UpdateDaption() Me.Caption = "Time: " & Format$(Now, "HH:MM:SS") End Sub http://uk.builder.com/downloads/0,39...tm?query=timer HTH to test the sub, I used the userform's click evnt to call the caption update routine "jarosinski2" wrote: I am working on a project using forms in excel. I need to have the time updated in the caption on the form. So, as each second passess I need to be able to see that. Please help! Thanks Andrew |
All times are GMT +1. The time now is 10:45 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com