
Tips.Net > WordTips Home > Formatting > Consistent Spacing
Summary: Do you need to check your document to make sure that each sentence has one and only one trailing space? This tip presents a macro that will make short work of getting rid of any extraneous spaces after sentences. (This tip works with Microsoft Word 97, Word 2000, Word 2002, and Word 2003.)
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. The problem is that it is easy to add additional spaces at the end of a sentence without even realizing it. The following VBA macro, CheckSpaces, is a tool you can use to double-check the end of your sentences:
Sub CheckSpaces()
Call MakeChanges("Normal", ".")
Call MakeChanges("Normal", "!")
Call MakeChanges("Normal", ":")
End Sub
Sub MakeChanges(StyName As String, PuncMark As String)
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles(StyName)
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = PuncMark & " "
.Replacement.Text = PuncMark & " "
.Forward = True
.Wrap = wdFindContinue
.Format = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.Text = PuncMark & " "
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
CheckSpaces will only take extra spaces out of paragraphs formatted with the Normal 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 fourth line in the macro.
Tip #262 applies to Microsoft Word versions: 97 2000 2002 2003
Take Control! Experienced users know that styles can make the difference between a plain document and a masterful one. This is the real power behind Word, and the key to that power can be found in WordTips: Styles and Templates.
Do you want a decade of WordTips information at your fingertips? You can find what you need with the WordTips Ten-Year Library. (more information...)
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
Pet Tips
Word2007 Tips
WordTips