ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to show time on the caption of excel window? (https://www.excelbanter.com/excel-programming/324792-re-how-show-time-caption-excel-window.html)

Robin Hammond[_2_]

how to show time on the caption of excel window?
 
The OnTime method will eventually fail for this - all it takes is one missed
call when you are editing a cell. Here's an alternative that relies on an
activex wrapper I put around the VB timer that you can get from my site
he
http://www.enhanceddatasystems.com/E...ExcelTimer.htm

The benefit of this is that the timer event does not fire while you are
editing a cell or Excel is busy, but does fire after you have stopped
whatever you are doing. It's also a lot simpler than using Windows API
callbacks.

1. Register the activex control (instructions on the web page)
2. Create a new project, add a form called frmTimer and a module.
3. Add the VBA Timer control to the form.
4. In the module add this

Sub StartClock()
With frmTimer.Timer1
.Interval = 1000
.Enabled = True
End With
'n.b. you do not need to show the form
End Sub

Sub StopClock()
Unload frmTimer
End Sub

5. In the form code, add this

Private Sub Timer1_Timer()
On Error Resume Next
Application.Caption = Format(Now, "HH:MM:SS")
On Error GoTo 0
End Sub

Robin Hammond
www.enhanceddatasystems.com

"show time on the caption of excel window" <show time on the caption of
excel wrote in message
...
how to show time on the caption of excel window? who can help me?





All times are GMT +1. The time now is 12:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com