Private Declare Function timeGetTime Lib "winmm.dll" () As Long
Dim lngStartTime As Long
Sub StartTimer()
lngStartTime = timeGetTime()
End Sub
Function EndTimer()
EndTimer = timeGetTime() - lngStartTime
End Function
用法示例:
Option Explicit
--------------------------------
Private WithEvents myTimer As XTimer
--------------------------------------------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
myTimer.Enabled = False
End Sub
---------------------------------------------------
Private Sub Workbook_Open()
Set myTimer = New XTimer
myTimer.Interval = 60000
myTimer.Enabled = True
End Sub
---------------------------------------------
Private Sub myTimer_Tick()
MsgBox "该休息一下了吧!!!"
End Sub