Clean up e-mail text in Word


Tip
E-mail messages and other ASCII files often include hard returns at the end of each line. When you open such text documents in Word, or cut and paste from your e-mail program, the text has strange line breaks and odd paragraph formatting. While Word has no built-in tool to fix these awkward documents, there is an easy solution that works in all versions of Word. If you handle many such documents, you'll want to record the steps as a macro so you won't have to repeat them.
1. Open the document you want to reformat, then start recording your macro. Select Tools--Macro, type a name for your macro, such as Cleanup, click Record, and in the Record Macro dialogue box, click OK.
2. Select Edit--Replace, type ^p (a caret and a "p") in the Find What box, and type ~ (a tilde) in the Replace With box. Click Replace All to replace all hard returns with tildes. Click OK at the prompt. The document will look strange, but don't worry about it.
3. While the Replace dialogue box is still on screen, type ~~ in the Find What box, and type ^p in the Replace With box. Click Replace All to replace all double hard returns (the normal break between paragraphs in text files) with a single hard return. Click OK at the prompt.
4. Type ~ in the Find What box, and type a single space in the Replace With box. Click Replace All to replace what was the single hard return at the end of a line with a space character to separate words. Click OK at the prompt, then click Close.
5. Click the Macro Stop button to turn off macro recording. You may still have to do some minor editing manually to finish cleaning up the document, but most of your work will be done.
The next time you need to clean up e-mail or ASCII text in Word, select Tools-- Macro--Macros, select the Cleanup macro, and click Run.
- George Campbell


Category: Word processing
Issue: Nov 1997
Pages: 174-176

These Web pages are produced by Australian PC World © 1997 IDG Communications