• Word as text editor (final par mark) (2002 SP-2)

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Word as text editor (final par mark) (2002 SP-2)

    • This topic has 3 replies, 3 voices, and was last updated 20 years ago.
    Author
    Topic
    #418126

    I’m thinking it would be kinda nice to be able to enlist the mighty Word as a simple text editor, so I could make use of macros & other handy features when I’m editing text files. Is there a simple way to make Word save a document as a text file without adding a final CrLf?

    Viewing 1 reply thread
    Author
    Replies
    • #940029

      I don’t think so. You could write a macro that
      – Saves the document as a text file.
      – Closes it.
      – Uses the VB text file instructions to remove the last line end.
      But is it really necessary?

    • #940106

      It’s very rare to see text files without a final CRLF pair – generally that would be an error, even in a text editor such as notepad

      • #940149

        Thanks for both responses. I was focusing on text files that would be data storage vehicles whose contents would be read by code (Scripting.TextStreams and the like), and I was concerned that having a CrLf at the end would effectively mean the file contained a bogus empty “final record.” But after a little experimentation, it looks like that may not be an issue. Using either the Scripting.TextStream.ReadLine method or VB’s Line.Input method to loop through a sample file, I get the same result whether there’s a CrLf at the end of the last record or not — i.e., the added CrLf doesn’t cause either code method to detect an extra record at the end.

        Word-format files always have final CrLf’s because certain formatting is stored there. WordPerfect doesn’t use paragraph marks that way, so a WordPerfect file don’t have a final CrLf unless you want to add it. Since text files don’t have any formatting to store, I’m not sure why a typical text file would end in a CrLf, but if it does, that certainly makes me more comfortable with the idea of using Word as a text editor (without having to implement some kind of SaveAsTextFileAndClose macro that strips the final CrLf after the file is out of Word’s clutches).

    Viewing 1 reply thread
    Reply To: Word as text editor (final par mark) (2002 SP-2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: