recuperation de quelque ligne sur un fichier séquenciel
bonjour, je voulais recuperer non pas la totalité du fichier texte mais quelque ligne , dans mon exemple , ce sont les ligne 1 , 12 et 14
mais j'ai pas reussi , il recupere les 3 premier ligne , comment sauter ses lignes ??
Code:
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
| Set fs = Application.FileSearch
' SS check
cmp = cmp + 1
With fs
.LookIn = "C:\SOCIAL"
.Filename = (nAmZ & ".txt")
If .Execute > 0 Then
Open ("c:\social\" & nAmZ & ".txt") For Input As #1
Do While Not (EOF(1))
i = i + 1
'MsgBox i
If (i = 1) Then
Line Input #1, toto
Range("a" & cmp) = toto
End If
If (i = 12) Then
Line Input #1, toto
Range("c" & cmp) = toto
End If
If (i = 14) Then
Line Input #1, toto
Range("b" & cmp) = toto
Exit Do
End If
Loop
Close #1 |
merci