1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Set fso = CreateObject("Scripting.FileSystemObject")
Set F = fso.OpenTextFile("MonTexte.txt", 1, False)
cnt = 0 ' compteur pour les lignes non vides
tb = Split(F.ReadAll,VbCrLf)
NewTxt = ""
For i = 0 To UBound(Tb)
If tb(i) <>"" and tb(i) <> "---" Then
cnt = cnt + 1
NewTxt = NewTxt & Qt(tb(i)) & ","
If cnt mod 2 = 0 Then NewTxt = NewTxt & vbNewLine
If cnt mod 4 = 0 Then NewTxt = NewTxt & "---" & vbNewLine
End If
Next
Function Qt(strIn)
Qt = chr(34) & strIn & chr(34)
End Function
NewTxt = "---" & vbNewLine & NewTxt
MsgBox NewTxt |
Partager