
Tips.Net > WordTips Home > Formatting > Consistent Spacing in WordBasic
Summary: Want to make sure you have the same number of spaces at the end of every sentence? This WordBasic macro will help you be consistent. (This tip works with Microsoft Word 6, and Word 95.)
There is an unwritten rule in typesetting that there should only be one space after the end of a sentence. This provides the best visual appearance on a printed page, particularly when using proportional typefaces. (If you are using monospace fonts, as you would on a typewriter, then you should use two spaces after the end of a sentence.) The problem is that it is easy to add additional spaces at the end of a sentence without even realizing it. The following WordBasic macro, CheckSpaces, is a tool you can use to double-check the end of your sentences.
Sub MAIN
MakeChanges("Body text", ".")
MakeChanges("Body text", "!")
MakeChanges("Body text", ":")
MakeChanges("Body text", Chr$(34))
End Sub
Sub MakeChanges(StyName$, PuncMark$)
FromWord$ = PuncMark$ + " "
ToWord$ = PuncMark$ + " "
StartOfDocument
EditFindStyle .Style = StyName$
EditReplace .Find = FromWord$, .Replace = ToWord$, \
.WholeWord = 0, .MatchCase = 0, .Format = 1, .ReplaceAll = 1
FromWord$ = PuncMark$ + " "
EditReplace .Find = FromWord$, .ReplaceAll = 1
End Sub
CheckSpaces will only take extra spaces out of paragraphs formatted with the Body text style. This ensures you won't mess up formatting in tables or other design elements where you may want extra spaces after periods. If you want to change the type of punctuation searched for, or search in different style paragraphs, add additional calls to MakeChanges after the fifth line in the macro.
Tip #261 applies to Microsoft Word versions: 6 95
Save Time! WordTips has been published weekly since early 1997. Past issues are available in convenient WordTips archives. Have your own enhanced archive of WordTips at your fingertips, available to use at any time!
Check out WordTips Archives today!
Discover how to use Word's mail merge tool to create your own custom documents in just minutes. Great e-book answers all your questions. (more information...)
Ask a Word Question
Make a Comment
Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips