Sub Enregister()
Dim CheminDossier$, dossier, i As Byte, chemin$, o As Boolean, NomRep As String
CheminDossier = "C:\Documents and Settings\JFL CONTROLE\Bureau\Trames\"
dossier = Array("CONTROLES CLIENTSbis") 'noms des dossiers
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For i = 0 To UBound(dossier)
  chemin = CheminDossier & dossier(i) & "\"
  nomfich = Dir(chemin & "*.xls*") '1er fichier du dossier
  While nomfich <> ""
    o = False
    On Error Resume Next
    If IsError(Workbooks(nomfich).Name) Then 'si le fichier n'est pas déjà ouvert, on l'ouvre
       
       Application.EnableEvents = False 'on bloque les évènements de ThisWorkbook open
       
       Workbooks.Open chemin & nomfich
       Sheets("Page 1").Activate
       NomRep = Cells(35, 26).Value & "" & Cells(40, 26).Value 'Détermine le nom du dossier
       
       Application.EnableEvents = True 'on rétablit les évènements
       
       o = True
    End If
    On Error GoTo 0
    
    chemin = "C:\Documents and Settings\JFL CONTROLE\Bureau\Trames\CONTROLES CLIENTS\"
           
    ActiveWorkbook.SaveAs chemin & NomRep & "\" & nomfich
    
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
    If o Then ActiveWorkbook.Close SaveChanges:=True 'si le fichier a été ouvert on le ferme
    
    nomfich = Dir 'fichier suivant du dossier
  Wend
Next
End Sub