Private Type KeyboardBytes
kbByte(0 To 255) As Byte
End Type
Enum apiOnOff
apiOn = 1
apiOff = 0
End Enum
Dim kbArray As KeyboardBytes
Private Declare Function GetKeyboardState Lib "user32" (kbArray As KeyboardBytes) As Long
Private Declare Function SetKeyboardState Lib "user32" (kbArray As KeyboardBytes) As Long
Private Sub ChangerCapsLock(v As apiOnOff)
GetKeyboardState kbArray
kbArray.kbByte(&H14) = v
SetKeyboardState kbArray
End Sub
Sub CapsOff()
' A PLACER DANS Private Sub Workbook_BeforeClose(Cancel As Boolean)
' ChangerCapsLock apiOff
End Sub
Sub CapsOn()
' A PLACER DANS Workbook_Open()
'ChangerCapsLock apiOn
End Sub
'
Private Sub Workbook_Open()
ChangerCapsLock apiOn
End Sub
'
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ChangerCapsLock apiOff
End Sub