Sub Auto_open() ' ' Macro1 Macro ' ' ' === Ouverture Fichier === DefaultFilePath = ThisWorkbook.Path Sortie = 0 Do Until Sortie = 1 MonFichier = Application.GetOpenFilename("Text Files (*.txt), *.txt") If MonFichier = "Faux" Then Rep = MsgBox("Vous n'avez pas sélectionné de fichier", vbRetryCancel, "Que fait-on ?") If Rep = vbCancel Then If Left(Environ("COMPUTERNAME"), 3) = "GS-" Then Exit Sub Else ThisWorkbook.Close Application.Quit End If End If Else Sortie = 1 End If Loop ' === Effacer feuille 1 === Sheets("Feuil1").Select Cells.Select Selection.Font.Bold = False With Selection.Font .ColorIndex = xlAutomatic .TintAndShade = 0 End With Selection.ClearContents Columns("A:A").ColumnWidth = 71 Range("A1").Select ' === Charger fichier === i = 0 IndexFichier = FreeFile() Open MonFichier For Input As #IndexFichier While Not EOF(IndexFichier) Line Input #IndexFichier, Maligne If MalignePre <> Maligne Then i = i + 1 Range("A" & i) = Maligne MalignePre = Maligne End If Wend Close #IndexFichier Dernl = i For i = 1 To Dernl If Range("A" & i).Value Like "*Etat: OK*" Then Range("A" & i).Font.ColorIndex = 50 Range("A" & i).Font.Bold = True End If If Range("A" & i).Value Like "*Etat: Défaut*" Then Range("A" & i).Font.ColorIndex = 3 Range("A" & i).Font.Bold = True End If ' If Range("A" & i).Value Like "-----*" Then Range("A" & i).Font.Bold = True Range("A" & i + 1).Font.Bold = True End If ' If Range("A" & i).Value Like "Scanner: *" Then Range("A" & i) = Range("A" & i) & " " & Range("A" & i + 1) Range("A" & i + 1) = "" End If Next i Entete = 0 For i = 1 To Dernl If Range("A" & i).Value Like "-----*" Then Range("A" & i).Font.Bold = True Entete = i + 1 End If If Range("A" & i).Value Like "Aucun code défaut trouvé*" Then Range("A" & Entete).Font.ColorIndex = 50 Else If Range("A" & i).Value Like "*défaut trouvé*" Then Range("A" & Entete).Font.ColorIndex = 3 For j = i To Dernl If Range("A" & j).Value Like "-----*" Then Exit For End If X_LignErr = Left(Range("A" & j).Value, 5) If IsNumeric(X_LignErr) = True Then Range("A" & j).Font.ColorIndex = 5 Range("A" & j).Font.Bold = True Application.CutCopyMode = False Range("B" & j).Select ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _ "https://wiki-ross--tech-com.translate.goog/wiki/index.php/" & X_LignErr & "?_x_tr_sl=en&_x_tr_tl=fr&_x_tr_hl=fr&_x_tr_sch=http", TextToDisplay:="Voir Wiki" Range("B" & j + 1).Select ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _ "https://www.gerritspeek.nl/vag-com_dtc-" & X_LignErr & ".html", TextToDisplay:="Voir gerritspeek.nl" Application.CutCopyMode = True End If Next j End If End If Next i MonFichier = Replace(MonFichier, ".txt", ".pdf") With ActiveSheet.PageSetup .FitToPagesWide = 1 .FitToPagesTall = 100 End With ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=MonFichier, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True ' ' === Copie erreur sur feuille2 === Sheets("Feuil1").Select Range(Columns(1), Columns(2)).Select Selection.Copy Sheets("Feuil2").Select Range("A1").Select ActiveSheet.Paste Range("A1").Select ' === Position premier calculateur === For i = 1 To Dernl If Range("A" & i).Value Like "-----*" Then Exit For End If Next i ' === Effacement calculateurs OK === For i = i + 1 To Dernl If Range("A" & i).Font.ColorIndex = 50 Then For j = i To Dernl Rows(i).EntireRow.Delete Dernl = Dernl - 1 If Range("A" & i).Value Like "-----*" Then Rows(i).EntireRow.Delete i = i - 1 Dernl = Dernl - 1 Exit For End If Next j End If Next i MonFichier = Replace(MonFichier, ".pdf", "_err.pdf") With ActiveSheet.PageSetup .FitToPagesWide = 1 .FitToPagesTall = 100 End With ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=MonFichier, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True Sheets("Feuil1").Select Range("A1").Select ThisWorkbook.Close Savechanges:=False Application.Quit End Sub