Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

appending to a textfile

Status
Not open for further replies.

maboo

Programmer
Jan 4, 2002
21
US
i want to append to a text file. so far it only overwrites it.
i think it has something to do with the second paramater
in the createtextfile line.
can someone help me?
set outFile = Server.CreateObject"Scripting.FileSystemObject")
Set outFileText = outFile.CreateTextFile(filename,8,true)
outFileText.writeline "text
outFileText.close
set outFileText = nothing
set outFile = nothing

thanks in advance
maboo
 
try this


set outFile = Server.CreateObject("Scripting.FileSystemObject")
Set outFileText = outFile.CreateTextFile(filename,ForAppending,true)
outFileText.writeline "text"
outFileText.close
set outFileText = nothing
set outFile = nothing
Tony
 
in order for the ForAppending to be recognised, you need the following line to be added to the page (or to an include file that it refers to)

<!-- METADATA TYPE=&quot;typelib&quot; FILE=&quot;C:\Program Files\Common Files\System\ado\msado15.dll&quot; -->

obviously change the path to reflect the actual path on the server.

hope this helps Tony
 
thanks fester.
i went in a different direction.
in changed the createtextfile to opentextfile
and it worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top