Sub Macro1()
Dim Wbk As Workbook, Client As String, OuvertParMacro As Boolean
Client = "Toto" ' à adapter
On Error Resume Next
Set Wbk = Workbooks("encodage.xlsm")
OuvertParMacro = Err.Number <> 0
If OuvertParMacro Then
Err.Clear
Set Wbk = Application.Workbooks.Open("C:\Users\" & Client & "\Dropbox\cobra\Comptabilite\2021\encodage.xlsm")
If Err Then MsgBox "Impossible d'ouvrir le fichier", vbCritical, "Macro1": Exit Sub
End If
On Error GoTo 0
…
If OuvertParMacro Then Wbk.Close SaveChanges:=False
End Sub