Written by Allen Wyatt (last updated July 11, 2020)
This tip applies to Word 97, 2000, 2002, and 2003
One of the biggest problems in formatting what was previously an ASCII file is modifying it so there are only hard returns at the end of paragraphs. Most ASCII files have a hard return at the end of every line of the file, and two hard returns at the end of every paragraph. If you have an ASCII file that is formatted like this, such as something you downloaded off the Internet, the following macro will be invaluable. It formats an entire file so there are only hard returns at the end of paragraphs.
Sub ConvertASCII() Fmt "^p^p", "{|}" Fmt "^p", " {@}" Fmt " {@}", " " Fmt "{@}", " " Fmt "{|}", "^p" End Sub
Sub Fmt(sFromWord, sToWord) Set myRange = ActiveDocument.Content myRange.Find.ClearFormatting myRange.Find.Execute FindText:=sFromWord, _ ReplaceWith:=sToWord, MatchCase:=0, _ Replace:=wdReplaceAll End Sub
You should run the ConvertASCII macro. It calls the Fmt macro several times to replace various combinations of return characters to get toward the desired result.
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 (187) applies to Microsoft Word 97, 2000, 2002, and 2003.
The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!
There is no need to press Enter a second time at the end of each paragraph. Let Word take care of the spacing ...
Discover MoreMost text appears black on white, not white on black. If you want to change this so that your type is reversed, here's a ...
Discover MoreWordPerfect users are familiar with the F4 command, which indents and justifies a paragraph. Word does not have an ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2023-12-04 15:06:32
Bill Jeffrey
Re formatting an ASCII file - paragraph marks. Assuming you are doing this as a one-off, and not habitually, Word's FIND and REPLACE can do the same thing without the bother of creating a macro. Just FIND ^p^p and REPLACE it with a tilde, for example. Then FIND ^p and REPLACE it with a space. Then FIND the tilde and REPLACE it with ^p (or with ^p^p if you want a blank line between paragraphs). Add ^t in the REPLACE field if you want a tab at the beginning of the paragraph.
Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon 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 © 2025 Sharon Parq Associates, Inc.
Comments