Wednesday, 23 February 2011

CONVERT TEXT FILE TO EXCEL

set fso=createobject("scripting.filesystemobject")
set wfile=fso.opentextfile("D:\test.txt")

set obj=createobject("excel.application")
obj.displayalerts=false
obj.visible=true
set wb=obj.workbooks.add()
set ws=wb.worksheets(1)
x=1
do until wfile.AtEndofstream
ws.cells(x,1)=wfile.readline
x=x+1
loop

wb.saveas("D:\test.xlsx")

No comments:

Post a Comment