j'ai fait un module pour te satisfaire, voici 2 fonctions l'une te renvois le nombre de lignes d'un fichier l'autre écrit un fichier contenant tout les charactères d'un fichier a partir d'un certain nombre de lignes
Public Function NB_Lignes(fichier As String) As Long
On Error Resume Next
Dim Lignes As Long
Dim chaine As StringIf Dir$(fichier) "" Then NB_Lignes 0: Exit Function
Open fichier For Input As #1
Do While Not EOF(1)
Line Input #1, chaine
Lignes = Lignes + 1
Loop
Close #1
NB_Lignes = Lignes
End Function
Public Sub Lire_Fichier(fichier As String, Ligne As Long)
On Error Resume Next
If Dir$(fichier) = "" Then
MsgBox "Fichier introuvable !", vbCritical, "Attention"
Exit Sub
End If
Open App.Path & "\Resultat.txt" For Output As #1: Close #1
Dim chaine As String
Dim Lignes As Long
Open fichier For Input As #1
Do While Not EOF(1)
Line Input #1, chaine
Lignes = Lignes + 1
If Lignes >= Ligne Then
Open App.Path & "\Resultat.txt" For Append As #2
Print #2, chaine
Close #2
End If
Loop
Close #1
End Sub
por utiliser ces fonctions, voici un exemple:
Private Sub Command1_Click()
Text2.Text = NB_Lignes(Text1.Text)' text1 ext l'adresse de ton fichier text2 est le nombre de lignes kil trouve
End Sub
Private Sub Command2_Click()
Call Lire_Fichier(Text1.Text, Text3.Text) 'text1 est l'adresse de ton fichier, texte3 est la position a partire de laquelle tu vu commencer de lire
le tout s'écrit dans un fichier resultat.txt pas dans une variable pask'une variable est limitée en charactères
End Sub
K@zuya 8-)