1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Function EcrireCSV(Chemin As String, Fichier As String, Table, Nbcol As Integer) As Boolean
EcrireCSV = False
'Close #1
Open Chemin & Fichier For Output As 1
For p = LBound(Table) To UBound(Table)
ab = Empty
For n = 0 To Nbcol
'pour controle de presence du chr(13) dans tableau
If n = Nbcol Then
de = Len(Table(p, n))
If de > 0 Then
Table(p, n) = Replace(Table(p, n), Chr(13), "")
End If
End If
ab = ab & ";" & Table(p, n)
Next n
'suppression 1er ";"
ab = Mid(ab, 2, Len(ab))
'ecrire
Print #1, ab
Next p
Close #1
EcrireCSV = True
End Function |