Importer les 5 dernières lignes d'un fichier texte
Utilise cette macro:
sub test()
Dim file_name As String
Dim file_length As Long
Dim fnum As Integer
Dim bytes() As Byte
Dim txt As String
Dim i As Integer
file_name = "F:DocFloessai.txt"
file_length = FileLen(file_name)
f2 = 1000
f1 = file_length - f2
fnum = FreeFile
Open file_name For Binary As #fnum
ReDim bytes(1 To f2)
Get #fnum, f1 + 1, bytes
Close fnum
' Afficher résultats
For i = 1 To f2
txt = txt & Chr(Format$(bytes(i)))
Next i
Debug.Print txt
end subAuteur : Mishell
Mots clefs associés à cette page : importer, texte
- Vous devez vous identifier ou créer un compte pour écrire des commentaires
