1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| If result = vbYes Then
For Each File In FSO.getfolder(Directory2).Files
i = i + 1
ff(i) = FreeFile
TabCheminTp(i) = Directory2 & "fichier N°" & CStr(i)
j = 0
Open TabCheminTp(i) For Input As #ff(i)
For j = 1 To nbrefichier(i)
If j = 1 Then ' on ne tiendra pas compte de la premiere ligne
Input #ff(i), a, b, c
FirstLign(i) = a & b & c 'stockage de la first line
valeur0(i) = a
valeur1(i) = b
valeur2(i) = c
Else
Input #ff(i), d, e, f, g, h, k, l, m, n 'a,b,c,... representent les valeurs comprise entre les virgules
For y = 1 To NbreSup 'ici on recupère les ligne a supprimer ds le ' fichier final
If e = DelTab(y) Then
DelLigne(i, j) = j
MsgBox ("ligne trouvee")
End If
Next
End If
Next
Close #ff(i)
Next
'ici je fais la copie du fichier A
For Each File In FSO.getfolder(Directory2).Files
i = i + 1
j = 0
ff(i) = FreeFile
TabCheminTp(i) = Directory2 & "fichier N°" & CStr(i)
Open TabCheminTp(i) For Input As #ff(i)
While Not EOF(ff(i))
j = j + 1
Line Input #ff(i), sligne(j)
ColLigne2(i).Add sligne(j)
Wend
Close #ff(i)
Next
'ici je fais une recriture ds le fichier AB
i = 0
For Each File In FSO.getfolder(Directory2).Files
i = i + 1
ff(i) = FreeFile
TabCheminTp(i) = Directory2 & "fichier N°" & CStr(i)
j = 0
Open TabCheminTp(i) For Output As #ff(i)
'valeur0(i) = j
FirstLign(i) = valeur0(i) & "," & valeur1(i) & "," & valeur2(i)
Print #ff(i), FirstLign(i)
For y = 2 To nbrefichier(i)
If (y <> DelLigne(i, y)) Then
Print #ff(i), ColLigne2(i)(y)
End If
Next
Close #ff(i)
Next |
Partager