Titre: Lire un fichier.
Description:
Lecture d'un bloc de la totalité d'un fichier.
Le code:
Private Sub Command1_Click() Dim C1%, C2&, Max&, Str1() As String, Tampon As String C1 = FreeFile Open App.Path & "\" & "Texte.txt" For Binary As #C1 C2 = LOF(C1) Tampon = Space$(C2) Get #C1, , Tampon Close #C1 Str1() = Split(Tampon, vbCrLf) Max = UBound(Str1()) Text1.Text = Max & " mots." & Chr(13) & Chr(10) & Tampon End Sub |