Please Note: This article is written for users of the following Microsoft Word versions: 2007 and 2010. 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: Determining If the End of a Text File Has Been Reached.
by Allen Wyatt
(last updated April 8, 2016)
In other issues of WordTips you learn how to access text files from within a macro. Another command associated with sequential text files is the EOF function. If used on an open file, EOF returns a True or False condition, which indicates if the internal file pointer is located at the end of the file. This function is most often used when inputting information from a text file, as shown here:
Open "MyFile.Dat" for Input as #1 J = 0 While Not EOF(1) J = J + 1 Line Input sMyString(J) Wend
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (11142) applies to Microsoft Word 2007 and 2010. You can find a version of this tip for the older menu interface of Word here: Determining If the End of a Text File Has Been Reached.
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!
It is often helpful to have a list of all the documents in a given directory or folder. Word doesn't have a built-in way to ...Discover More
When you save your documents, Word doesn't normally make backups of your files. If you want the program to do that, it takes ...Discover More
If you need to work with a copy of a document rather than the original document, you can use Word's Open dialog box to ...Discover More