'### Constante à adapter ###
Public Const CHAINE_SANS_ACTION As String = "repos"
Private Const MUSIQUE As Boolean = True 'False pour enlever la musique
Private Const DELAI As Long = 90 'Délai de chaque note de musique
'###########################
Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function Beep& Lib "Kernel32" (ByVal Fq&, ByVal Tm&)
Public BoolStop As Boolean
Public R As Range
Sub Timer(Cellule As Range)
Set R = Cellule
Application.OnTime Now, "Clignote"
End Sub
Sub Clignote(Optional dummy As Byte)
Dim notes As Variant
Dim OldColor&
Dim OldSize&
Dim i&
notes = Array(500, DELAI, 500, DELAI, 500, DELAI, 550, DELAI, 625, 2 * DELAI, 550, 2 * DELAI, _
500, DELAI, 625, DELAI, 550, DELAI, 550, DELAI, 500, 3 * DELAI)
BoolStop = True
With R.Font
OldColor& = .ColorIndex
OldSize& = .Size
.Size = 20
End With
If MUSIQUE Then
For i& = LBound(notes) To UBound(notes) Step 2
Beep notes(i&), notes(i& + 1)
Next i&
End If
Do Until Not BoolStop
i& = i& + 1
If i& Mod 57 = 0 Then i& = 1
Sleep 25
DoEvents
R.Font.ColorIndex = i&
Loop
With R.Font
.ColorIndex = OldColor&
.Size = OldSize&
End With
End Sub