1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| SourceFile = "C:\test.txt"
Set fs = CreateObject("Scripting.FileSystemObject")
Set Stream = fs.OpenTextFile(SourceFile)
WBFile = "C:\test.xls"
SheetName = "Feuil1"
Set Application = CreateObject("Excel.Application")
Set WB = Application.Workbooks.Open(WBFile)
Set S = WB.Worksheets(SheetName)
While Not Stream.AtEndOfStream
c = c + 1
if c >= 4 then
S.Cells(1, c).Value = Stream.ReadLine
montab = Split(S.Cells(1, c).Value, ",")
For i = 0 To 5
S.Cells(c, i + 1).Value = montab(i)
Next
end if
Wend
WB.Close
Stream.Close
set Application = Nothing
Set fs = Nothing |