Word.Tips.Net Welcome toWord.Tips.Net

Helpful Links

Tips.Net Home
WordTips Home

Ask a Word Question
Make a Comment

Tips.Net Store

WordTips FAQ
WordTips Premium

Learn Access Now
Free Printable Forms

Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips

Advertise on the
WordTips Site

Newest Tips

Printing On Both Sides of the Paper

Turning Off AutoComplete for Dates

Ordering Search and Replace

Understanding Auto Line Spacing

Adding Comments to Your Document

Conditional Calculations in Word

Determining Word Frequency

 

Stripping Trailing Spaces with WordBasic

Summary: A quick way to remove trailing spaces from a paragraph. (This tip works with Microsoft Word 6, and Word 95.)

Maybe I'm one of those compulsive-obsessive types, but I always go through my documents to make sure there are no trailing spaces at the end of a line. This makes the document neater and smaller. If you format ASCII files, you will need to search for trailing spaces, and remove them, as you format the file for Word. The following WordBasic macro, StripSpaces, will take out all spaces before paragraph marks and manual line breaks throughout your document.

Sub MAIN
StartOfDocument
EditFindClearFormatting
EditReplaceClearFormatting

EditFind .Find = " ^p", .WholeWord = 0, .MatchCase = 0, \
.Direction = 1, .Format = 0
While EditFindFound()
    StartOfDocument
    EditReplace .Find = " ^p", .Replace = "^p", \
    .WholeWord = 0, .MatchCase = 0, .Format = 0, \
    .ReplaceAll = 1
    RepeatFind
Wend

EditFind .Find = " ^l", .WholeWord = 0, .MatchCase = 0, \
.Direction = 1, .Format = 0
While EditFindFound()
    StartOfDocument
    EditReplace .Find = " ^l", .Replace = "^l", \
    .WholeWord = 0, .MatchCase = 0, .Format = 0, \
    .ReplaceAll = 1
    RepeatFind
Wend

End Sub

Tip #968 applies to Microsoft Word versions: 6 | 95

Tremendous Table Tips! We often take tables for granted, but Word includes some very powerful ways you can present your tabular data. Discover how to make your tables better, easier to understand, and more effective.
 
Check out WordTips: Terrific Tables today!