Thanks for the input Ivan,
The code works apart from two problems:
1- Everytime I select a Cell in the worksheet, I get a RunTime error("Method Evaluate Of Object WorkSheet Failed"). I had to add an On Error Resume Next Statement to avoid this error.
2- the moment I exit Design Mode(After embeeding the Timer Control),The IETimer Control strangely disappears and is no longer visible on the worksheet layer or reappears but remains disabled!!
Is this Control supposed to behave like that ??
Also, what is the point of having a Control on a worksheet if the User can't interact with it ?
In order to avoid using an embeeded IETimer Control altogether I tried establishing a rederence to the IETimer Object Via Tools\References in the VBEditor and trap this object's event by means of a Class Module as follows:
This code goes in the
Class Module TimerClass
<font face=Courier New><SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">WithEvents</SPAN> Tmr <SPAN style="color:#00007F">As</SPAN> IeTimer
<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Tmr_Timer()
[B2] = Format(Now, "dd/mm/yyyy hh:mm:ss")
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>
This code goes in a
Standard Module:
<font face=Courier New><SPAN style="color:#00007F">Public</SPAN> TmrObject <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">New</SPAN> TimerClass
<SPAN style="color:#00007F">Sub</SPAN> StartTimer()
<SPAN style="color:#00007F">Set</SPAN> TmrObject.Tmr = <SPAN style="color:#00007F">New</SPAN> IeTimer
TmrObject.Tmr.Interval = 1
TmrObject.Tmr.Enabled = ValTrue
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
<SPAN style="color:#00007F">Sub</SPAN> StopTimer()
TmrObject.Tmr.Enabled = ValFalse
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>
Although the above codes seem very correct to me, for some reason, when I run the StartTimer Sub, Cell B2 doesn't update which means the code doesn't work !!
I just can't spot what I may be doing wrong ! :x
I hope you can find out what the problem is.
Looking forward to hearing from you.