Resting Anchor

The Anchorage

Personal website of Gregory K. Maxey, Commander USN (Retired)

Space After Sentences
(A Microsoft Word Help & Tip page by Gregory K. Maxey)

DISCLAIMER/TERMS OF USE

The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.

Click to acces PayPal Verification Service Click to acces PayPal Verification Service

However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.

If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!

Click to donate British Pound Sterling                   Click to donate US dollars                   Click to donate EU euros

The purpose of this Microsoft Word Tips & Microsoft Word Help page is is not to solve or even enter the debate on the proper spacing to use after full stop punctuation. Some people prefer one space and others prefer two. My purpose is to provide a simple macro that users can run after they have completed their document to automatically set two spaces after each full stop punctuation mark (i.e., a period, and question mark, or an exclamation mark)

VBA Script:
Sub TwoSpacesAfterSentence()
Dim oRng As Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .ClearFormatting
    .MatchWildcards = True
    .Text = "(*{2})([.\!\?]) ([A-Z])"
    .Replacement.Text = "\1\2  \3" 'Two spaces between 2 and \
    .Execute Replace:=wdReplaceAll
    .Text = "([.\!\?]) {3,}([A-Z])"
    .Replacement.Text = "\1  \2"
    .Execute Replace:=wdReplaceAll
    'This should prevent most cases of improper double spacing
    'in names (e.g., F. Lee Bailey, George W. Bush, etc.)
    .Text = "([!A-Z][A-Z].)  ([A-Z])" 'Two spaces between ) and (
    .Replacement.Text = "\1 \2"
    .Execute Replace:=wdReplaceAll
  End With
lbl_Exit:
  Exit Sub
End Sub
    

Site Note icon See: Installing Macros for instructions on how to set up and use the macros provided in this Microsoft Word Help & Microsoft Word Tips page.

That's it! I hope you have found this tips page useful and informative.

Share

DISCLAIMER/TERMS OF USE

The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.

Click to acces PayPal Verification Service Click to acces PayPal Verification Service

However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.

If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!

Click to donate British Pound Sterling                   Click to donate US dollars                   Click to donate EU euros

Search my site or the web using Google Search Engine

Google Search Logo