Option Explicit
Private Declare PtrSafe Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Public Double_Clic_en_Cours As Boolean
Sub Bloque_Clavier()
Dim Compteur As Byte
On Error Resume Next
For Compteur = 1 To 255
If Compteur < 13 Then Application.OnKey "{F" & Compteur & "}", ""
Application.OnKey Chr(Compteur), ""
Next Compteur
Application.DisplayFormulaBar = False
Double_Clic_en_Cours = True
DoEvents
If GetKeyState(vbKeyNumlock) = 1 Then CreateObject("wscript.shell").SendKeys ("{NUMLOCK}")
End Sub
Sub Debloque_Clavier()
Dim Compteur As Byte
On Error Resume Next
For Compteur = 1 To 255
If Compteur < 13 Then Application.OnKey "{F" & Compteur & "}"
Application.OnKey Chr(Compteur)
Next Compteur
Application.DisplayFormulaBar = True
Double_Clic_en_Cours = False
DoEvents
If GetKeyState(vbKeyNumlock) = 0 Then CreateObject("wscript.shell").SendKeys ("{NUMLOCK}")
End Sub