FSO working but I want to save previous text

Results 1 to 2 of 2

Thread: FSO working but I want to save previous text

  1. #1
    Join Date
    Dec 1969

    Default FSO working but I want to save previous text

    I am using FSO and it is working but now I want to add to the end of my text document, so I can create a daily running log file, that saves the previous text and just adds to the end. Does anyone know how to do this? <BR>Jose<BR><BR>here is my code so far...<BR>Public Sub Update_Logg_File()<BR> &#039;the purpose of this routine is to create a logg file that can be accessed<BR> &#039;and managed at a later time. This file can also be used for troubleshooting.<BR> <BR> Dim fso As FileSystemObject<BR> Dim logfile<BR> <BR> Set fso = New FileSystemObject<BR> <BR> Set logfile = fso.CreateTextFile("c:deldexlog.txt", True)<BR> logfile.WriteLine ("This is a test3.")<BR> logfile.WriteBlankLines (1)<BR> logfile.WriteLine ("this is a new line3")<BR> logfile.WriteBlankLines (1)<BR> logfile.WriteLine ("another line3...")<BR> logfile.Close<BR> <BR>End Sub<BR>

  2. #2
    Join Date
    Dec 1969

    Default how about append

    This isn&#039;t your code but you should be able to adapt it for your use. Open the file for append.<BR><BR>&#039; Dimension local variables<BR>Dim MyFile <BR>Dim FSO &#039; FileSystemObject<BR>Dim TSO &#039; TextStreamObject<BR><BR>&#039; always use MapPath function to get the Physical Path of file<BR>MyFile = Server.MapPath("yourfile.txt")<BR>Set FSO = Server.CreateObject("Scripting.FileSystemObject")< BR>Set TSO = FSO.OpenTextFile(MyFile,ForAppending)<BR>TSO.write filename<BR>TSO.write "insert what to write here"<BR>TSO.WriteLine ""<BR><BR><BR>&#039; close TextStreamObject and <BR>&#039; destroy local variables to relase memory<BR>TSO.close<BR>Set TSO = Nothing<BR>Set FSO = Nothing

Posting Permissions

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