Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 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: Determining If the End of a Text File Has Been Reached.
Written by Allen Wyatt (last updated January 30, 2024)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365
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
Note:
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, 2010, 2013, 2016, 2019, and Word in Microsoft 365. 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.
Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!
Word allows you to save your documents in PDF format so others can easily view them. You may not know, however, that Word ...
Discover MoreWhen you are using Word, it normally saves temporary AutoRecover files that reflect the latest state of your document. If ...
Discover MoreNeed to combine several files into a single document? You can do it by inserting one file into another, as outlined in ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
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.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments