Append Text File

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Within my VBA code, I'd like to include the ability to append messages to a
text file located on the c:\ drive, e.g., "Logon successful" as a means of
tracking user history. The ability to include a date/time stamp as well
would be great. Any suggestions? Thanks.
 
Check out the built-in VBA method (Open Statement) for manipulating text
files:

Open "C:\MyFolder\FileName.txt" For Append As #1

Appending to an existing text file is one of the options.

Search Help using Open Statement as the search term.
 
By the way, sometimes it's a bit "difficult" to find these types of things
in Help. I often will open VBE and begin typing the code in the Immediate
Window (in this case:
Open "C:\My Documents"
)

and then put the cursor on the Open word and press F1. This is one of the
more successful ways to quickly find things in Help, as the "search" option
sometimes finds things that have nothing to do with what you typed in, and
not show things that do have something to do with what you typed in.
 
Back
Top