Wednesday, April 27, 2011

Writing Tools: Macros--replace periods

     One of the pet peeves of copyeditors is the dreaded double space after a period, or other sentence ending punctuation. And for authors preparing a manuscript, it becomes tedious to find and replace all these instances, even using the word processors feature. So here is a quick little macro for Word that does just that. Assign the macro to a button, and when it's time for the tediousness, simply click it.
     This macro can also be modified to accommodate exclamation points and question marks by replacing the period in the find and replace lines, then the whole thing could be run at once to replace all the spaces after end punctuation.

Here's the macro in its entirety:

Sub periodspace()
'
' periodspace Macro
'
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ". "
.Replacement.Text = ". "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub