Hi!

I used the next code to have a running clock in one of my workbooks:

In Module1:

Dim SchedRecalc As Date

Sub Recalc()

With Sheet2.Range("D2")

.Value = Format(Time, "hh:mm:ss AM/PM")

End With

Call SetTime

End Sub

Sub SetTime()

SchedRecalc = Now + TimeValue("00:00:30")

Application.OnTime SchedRecalc, "Recalc"

End Sub

Sub Disable()

On Error Resume Next

Application.OnTime EarliestTime:=SchedRecalc, Procedure:="Recalc", Schedule:=False

End Sub
and as ThisWorkbook:

 
Private Sub Workbook_WindowActivate(ByVal Wn As Window)
    Module1.Recalc
End Sub


The Problem is that now, when the workbook is closed and another excel is running, every time when the clock updates (I assume) it opens up the workbook with the clock. The only way I stop it is by closing all excel workbooks and opening the one I need (without the module). How can I stop the module from running when I close the workbook with the Macro\Module?

Please note: I have no any clue in VB. Every code I've done was with the help of nice peaple on this forum. So if you help, please do that in details.

Thank you in advance!