Save form data to appended text file?

T

Trent Shirley

Hi Everyone,
I would like to, during the close event automatically append the data from a
form to a text file.

Is there an easy method to do this? I can find more complex ways of doing
it but figure there is probably an easy way to automatically cause a save as
txt file to occur and hopefully having that save append to an existing file
rather than creating a new one.
 
G

Guest

This will create a new doc. Not sure how to append.

Set fso = CreateObject
("Scripting.FileSystemObject")
Set f1 = fso.CreateTextFile("c:\usernfo.txt", True)
f1.WriteBlankLines(3)
f1.WriteLine(UserInfo)
f1.WriteLine(JobFunction)
f1.WriteLine(SpecialServices)
f1.WriteLine(Comment)
f1.WriteLine(Item.userproperties
("CommentBar").value)
' Write three newline characters to the
file.
' f1.WriteBlankLines(3)
' Write a line.
' f1.Write ("This is a test.")
f1.Close
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top