Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, and Word in Office 365. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Appending to a Non-Document Text File.
by Allen Wyatt
(last updated February 10, 2018)
When working with text files, you may want to add information to an existing file, rather than creating a new text file from scratch. To do this, all you need to do is open the file for Append rather than Output. The following code shows this process:
Open "MyFile.Dat" For Append As #1 For J = 1 to NewValues Print #1, UserVals(OrigVals + J) Next J Close #1
When the file is opened for Append mode, any new information is added to the end of the file, without disturbing the existing contents.
Make sure you use this only on non-document text files, however. If you attempt this on a document file (meaning you change "MyFile.Dat" to something like "MyFile.Doc", and that is an existing document file), then there is a very real chance that the document will be corrupted and you will not be able to read it in Word any more.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (11138) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Office 365. You can find a version of this tip for the older menu interface of Word here: Appending to a Non-Document Text File.
Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!
You can easily insert one document within another document. What you may not know is that you can limit which part of a ...Discover More
Need to convert your document to a really old format previously used in Word? The solution may already be built into the ...Discover More
Want to rename a document that is already on your hard drive? You can, of course, do it in Windows, but you can also do ...Discover More
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.