Re: Double space after period, except when...
- From: "Doug Robbins - Word MVP" <dkr@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 13 Nov 2007 05:35:45 +1000
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
.
- Follow-Ups:
- Re: Double space after period, except when...
- From: JayneBartram
- Re: Double space after period, except when...
- References:
- Double space after period, except when...
- From: JayneBartram
- Double space after period, except when...
- Prev by Date: Re: Macro to Sort 5 Column Table
- Next by Date: Re: Sending Email Automatically
- Previous by thread: Double space after period, except when...
- Next by thread: Re: Double space after period, except when...
- Index(es):
Relevant Pages
|