Re: Double space after period, except when...



Replacing this line of the code

..Text = "([.\?\!]) {1,}"

with

..Text = "([.\?\!])"

would cause two spaces to be inserted after any . ? or !

That code should be run first, so that if there are already spaces there,
running the second code will reduce the number of them to two.

BUT, if there are decimal numbers in your document you would end up with two
spaces after the decimal point. To fix that, you would then need to use

". ([0-9]{1,})"

and replace with

".\1"

to remove those two spaces. Note there are two spaces between the . and the
( above.


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

<JayneBartram@xxxxxxxxxxxxxx> wrote in message
news:1194893308.007569.118300@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi, I've been using this really helpful macro offered by Allen Wyatt
on his "Word tips" web page.

Sub TwoSpaces()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([.\?\!]) {1,}"
.Replacement.Text = "\1 "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub

It replaces any number of spaces after a period with 2 spaces, as
required by my UK organisation.
What it doesn't do is add 2 spaces after a period if there is
currently no space after said period.

This punctuation error occurs often here, so please can anyone tell me
how the above macro can be modified to take care of this extra
problem, if possible?

Regards,
Jayne Bartram



.



Relevant Pages

  • Re: Mail merge and long tables
    ... Please reply to the newsgroup unless you wish to avail yourself of my ... services on a paid consulting basis. ... Doug Robbins - Word MVP ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Mail merge and long tables
    ... Please reply to the newsgroup unless you wish to avail yourself of my ... services on a paid consulting basis. ... Doug Robbins - Word MVP ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Mail merge and long tables
    ... Please reply to the newsgroup unless you wish to avail yourself of my ... services on a paid consulting basis. ... Doug Robbins - Word MVP ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Why does Word close when I close a file?
    ... services on a paid consulting basis. ... Doug Robbins - Word MVP ... File icon on the toolbar to close the files. ...
    (microsoft.public.word.docmanagement)
  • Re: Why does Word close when I close a file?
    ... services on a paid consulting basis. ... Doug Robbins - Word MVP ... File icon on the toolbar to close the files. ...
    (microsoft.public.word.docmanagement)