Option Explicit
Declare Function Beep Lib "kernel32" (ByVal Frequence As Long, ByVal Duree As Long) As Long
Private RunTime As Variant
Sub Beep_open()
Call Beep(1500, 880)
RunTime = Now + TimeValue("00:00:03")
Application.OnTime EarliestTime:=RunTime, Procedure:="Beep_open", Schedule:=True
End Sub
Sub Beep_close()
If MsgBox("On arrête ?", vbYesNo) = vbYes Then
If RunTime <> 0 Then Application.OnTime EarliestTime:=RunTime, Procedure:="Beep_open", Schedule:=False
RunTime = 0
End If
End Sub