Monday, January 21, 2013

Text File Operations in Vbs

Example :

Dim sPath
set fso=createobject("scripting.filesystemobject")
sPath=inputbox("enter path where you want to save the file")

fso.createtextfile sPath
set ctrl=fso.getfile("1.txt")
set mode=ctrl.openastextstream(8)
'1-read
'2-write
'8-append
mode.writeline "hi"
mode.writeblanklines 5
mode.writeline "end"
msgbox "over"
set fso=nothing

No comments:

Post a Comment