Sub lireFichierTexte()
Dim infosLigne As String
Dim i As Integer, x As Integer
Dim Tableau() As String
Open 'Config.ini' For Input As #1
Do While Not EOF(1)
Line Input #1, infosLigne
i = i + 1
Tableau = Split_97(infosLigne, Chr(9)) 'le separateur est Tab'
For x = 0 To UBound(Tableau)
Cells(i, x + 1) = Tableau(x)
Next
Loop
Close #1
End Sub
Public Function Split_97(Chaine$, Separateur$)
'FS, mpfe (renvoie un tableau de base 0)'
Dim Tablo(), pos%, S$
S = Trim(Chaine): ReDim Tablo(0)
Recurse:
pos = InStr(1, S, Separateur)
If pos = 0 Then
Tablo(UBound(Tablo)) = S
Split_97 = Tablo()
Exit Function
Else
Tablo(UBound(Tablo)) = Left(S, pos - 1)
S = Right(S, Len(S) - pos)
ReDim Preserve Tablo(UBound(Tablo) + 1)
GoTo Recurse
End If
End Function