Wednesday 23 February 2011

Convert word document to EXCEL

set fso=createobject("word.application")
set wfile=fso.documents.open("D:\test.doc")
str= wfile.content
a=split(str,Chr(13))
set obj=createobject("excel.application")
obj.displayalerts=false
obj.visible=true
set wb=obj.workbooks.add()
set ws=wb.worksheets(1)
for i=0 to ubound(a)-1
j=i+1
ws.cells(j,1)=a(i)
next
wb.saveas("D:\test.xlsx")
set wfile=nothing
set fs0=nothing
set obj=nothing

No comments:

Post a Comment