Bonsoir,
si l'erreur apparaît entre "collègues" alors les différents postes ne sont pas équivalent au niveau des versions d'Excel... Il faut en plus de ce que préconise Jean-Eric mettre en place un "if" afin d'envoyer VBA sur la bonne série de déclaration comme cela l'application sera compatible avec tous les postes.
#If VBA7 Then
Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
Declare PtrSafe Function EnableWindow Lib "user32" _
(ByVal hwnd As LongPtr, ByVal fEnable As Long) As Long
Declare PtrSafe Function GetWindowLongPtr Lib "user32" Alias "GetWindowLongA" _
(ByVal hwnd As LongPtr, ByVal nIndex As Long) As LongPtr
Declare PtrSafe Function SetWindowLongPtr Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
#Else
Private Declare Function FindWindowA& Lib "user32" (ByVal lpClassName$, ByVal lpWindowName$)
Private Declare Function EnableWindow& Lib "user32" (ByVal hwnd&, ByVal bEnable&)
Private Declare Function GetWindowLongA& Lib "user32" (ByVal hwnd&, ByVal nIndex&)
Private Declare Function SetWindowLongA& Lib "user32" (ByVal hwnd&, ByVal nIndex&, ByVal dwNewLong&)
#End if
Ai-je faux Jean-Eric ?
@ bientôt
LouReeD