Advertisement
NAK

RecordEntry

NAK
Apr 25th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function RecordEntry(r As Range)
  2. ' usage
  3. ' in the adjacent cell to your 'Name' column (e.g. cell B1) insert this Function
  4. ' = RecordEntry(A1)
  5. ' After you enter text Cell A1 it will get written to a text file Support.log along with the date and time
  6.  
  7.     Dim fso As New FileSystemObject
  8.    
  9.     ' Declare a TextStream.
  10.    Dim stream As TextStream
  11.    
  12.     ' Create a TextStream.
  13.    Set stream = fso.OpenTextFile("C:\temp\Support.log", ForAppending, True)
  14.    
  15.     For Each cell In r
  16.         ' record the vale of the cell in the log file
  17.        stream.Write cell.Text
  18.         stream.Write " "
  19.     Next
  20.  
  21.     ' write the current date and time
  22.    stream.Write Now()
  23.     ' new line
  24.    stream.WriteBlankLines (1)
  25.     stream.Close
  26.    
  27. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement