#If VBA7 Then
Private Declare PtrSafe Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
#Else
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
#End If
Function Xsendkeys(Key As Byte, Sens As Long)
Call keybd_event(Key, 0, Sens, 0)
'ExecuteExcel4Macro ("CALL(""user32"",""keybd_event"",""JJJJJ""," & Key & ", " & 0 & ", " & Sens & ", " & 0 & ")")
DoEvents
End Function
Sub a()
[A1].ClearContents
[A1].Select
Xsendkeys 65, &H1 'on apui sur la touche a
Xsendkeys 65, &H2 'on relache la touche a
Xsendkeys 66, &H1 ' on apui sur la touche b
Xsendkeys 66, &H2 'on relache la touche b
Xsendkeys 67, &H1 ' on apui sur la touche c
Xsendkeys 67, &H2 'on relache la touche c
Xsendkeys 13, &H1 ' on apui sur la touche enter
Xsendkeys 13, &H2 'on relache la touche enter
End Sub