1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| Dim fso
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Fdat = FSO.OpenTextFile("C:\file.dat")
Dim objXL
Set objXL = WScript.CreateObject("Excel.Application")
objXL.WorkBooks.Add
objXL.Visible = TRUE
Dim X, Y, Pos, Fline
X=1
Do While Not Fdat.AtEndOfStream
Fline = Fdat.Readline
call RemplirCell(Fline)
X = X+1
Loop
Fdat.Close
sub RemplirCell(Chaine)
Y = 1
do while Chaine <> ""
Pos = instr(Chaine,":")
if Pos > 1 then
objXL.Cells(X,Y).value = left(Chaine,Pos-1)
Chaine = right(Fline,len(Chaine)-Pos)
Y = Y+1
else
objXL.Cells(X,Y).value = Chaine
chaine = ""
end if
loop
end sub |
Partager