HELP: Appending to a .txt file: FileSystem Object!

Results 1 to 2 of 2

Thread: HELP: Appending to a .txt file: FileSystem Object!

  1. #1
    D.H. Guest

    Default HELP: Appending to a .txt file: FileSystem Object!

    I am trying to open up a .txt file and add some text to the file(based on some event) using the FileSystemObject, but I keep getting errors.<BR><BR>I :<BR>set obj=server.createobject("Scripting.filesystemobjec t")<BR>set objfile=obj.OpenTextFile("/schedule.txt")<BR>objfile.writeline("whatever")<BR ><BR>but i get errors, and it also says that it doesn&#039;t understand the &#039;ForAppending&#039; that also returns an error.<BR><BR>Can someone shed some light on this for me????

  2. #2
    Join Date
    Dec 1969

    Default RE: HELP: Appending to a .txt file: FileSystem Obj

    we have been getting a lot of posts regarding file system objects, there is definitely some problem with this object, anyway i wanted to use this for my project but found a way around, first up i guess u have to specify the constants because there is no default constant for "forappending"/"forreading"/&#039;forwriting".<BR>try this:<BR><BR>constant forappending = 8, forreading = 2 forwriting = 1 then<BR>open the filesystemobject<BR>and then instead of opening the file as "opentextfile" open it as a textstream object like this:<BR><BR>set objfile=obj.Openastextstream("/schedule.txt")<BR>while objfile.atendofstream<BR>objfile.writeline ....<BR>wend<BR><BR>----------------<BR>dunno if this will work or not but u can certainly try and do let me know if it does.<BR>good luck.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts