Welcome toWord.Tips.Net
Ask a Word Question
Make a Comment
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips
Standardizing Note Reference Placement
Selecting Printing of Color Pictures
Moving Rows and Columns With the Mouse
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.
Tip #187 applies to Microsoft Word versions: 97 2000 2002 2003 2007
Find and Replace Almost Anything! An invaluable resource for learning how to harness the full power of Word's search and replace capabilities. You'll discover everything you need in order to master all the intricacies of finding and replacing elements of your document, including the super-powerful "wildcard searches" available in Word.