Option Explicit
Public ESCKEY As Boolean
Private Sub Command1_Click()
ESCKEY = False
Do While Not ESCKEY
Cls
Print Time
DoEvents
Loop
End Sub
Private Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Then
ESCKEY = True
End If
End Sub