Results 1 to 10 of 10
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Posts
    1,418
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Inserting 2 spaces at beginning of sentences (2000)

    I am editing a document that has been converted to a word document from wordperfect. I would like to inset 2 spaces at the beginning of each sentence in a paragraph other than the 1st sentence. Any help?
    Thanks,
    Jeff

  2. #2
    Platinum Lounger
    Join Date
    Jan 2001
    Posts
    3,788
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Inserting 2 spaces at beginning of sentences (

    Hi Jeff

    If the only dots in the paragraph are fullstops then you can use find & replace to find the fullstop and replace it with a fullstop and 2 spaces.

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Posts
    1,418
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Inserting 2 spaces at beginning of sentences (

    Thanks, Tony. However, I am not sure what you mean by a "fullstop"-could this be a period at the end of a sentence perhaps?
    Thanks

  4. #4
    Platinum Lounger
    Join Date
    Jan 2001
    Posts
    3,788
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Inserting 2 spaces at beginning of sentences (

    Yes fullstop is the same as period - another difference between British & American English.

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting 2 spaces at beginning of sentences (

    Hi Jeff:
    Since I use 2 spaces between sentences, the following code will work on any selected paragraphs:
    <code>Sub 2Spaces()
    ' This puts 2 spaces between sentences
    With Selection.Find
    .Text = ". {1,}"
    .Replacement.Text = ". "
    .MatchWildcards = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Text = "? {1,}"
    .Replacement.Text = "? "
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
    .Text = "! {1,}"
    .Replacement.Text = "! "
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    End Sub</code>

    Cheers,

  6. #6
    Bronze Lounger
    Join Date
    Jan 2001
    Posts
    1,418
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Inserting 2 spaces at beginning of sentences (

    Thanks, Phil. Will this replace wnat is currently after the period but before the beginning of the next sentence (say an object, etc.)?

  7. #7
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting 2 spaces at beginning of sentences (

    No. This replaces a period, question mark, or exclamation point that are followed by one or more spaces with the same punctuation mark followed by 2 spaces. You can think of it as working on the end of a sentence, rather than putting two spaces before the beginning. By the way, before doing any extensive Find/Replace operations, I make sure that I work on a copy of the document (or have copied the original text so I can repaste it, if things go bad).

  8. #8
    3 Star Lounger
    Join Date
    Apr 2004
    Location
    Boston, Massachusetts, USA
    Posts
    389
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting 2 spaces at beginning of sentences (

    Here's a version that'll work on an entire document at once:
    <pre>Sub PutTwoSpaces()
    With ActiveDocument.Content.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .MatchWildcards = True
    .Format = False
    .Wrap = wdFindContinue
    .Forward = True
    .Text = "([!?.] )<"
    .Replacement.Text = "1 "
    .Execute Replace:=wdReplaceAll
    End With
    End Sub
    </pre>


    Hope this helps!

  9. #9
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Inserting 2 spaces at beginning of sentences (

    Hi Jeff,

    One thing to remember with any search/replace process that finds periods etc followed by a single space and replaces them with periods etc followed by a double space is that you will also get double spaces where you've got abbreviations etc in a sentence (eg Mr. Smith).

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  10. #10
    3 Star Lounger
    Join Date
    Apr 2004
    Location
    Boston, Massachusetts, USA
    Posts
    389
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting 2 spaces at beginning of sentences (

    Macropod raises a great point. A "sentence" is a very subjective thing. The following may yield slightly better results. It matches a period followed by a space, then a capital letter. But even that isn't foolproof, as you might hit something like "Mr. Anderson" . The better you know your content, the more accurately you can tune this sort of macro. If nothing else, I'd suggest running it with Track Changes on, so you can check for any false positives.

    <pre>Sub PutTwoSpaces()
    With ActiveDocument.Content.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .MatchWildcards = True
    .Format = False
    .Wrap = wdFindContinue
    .Forward = True
    .Text = "([!?.] )([A-Z])"
    .Replacement.Text = "1 2"
    .Execute Replace:=wdReplaceAll
    End With
    End Sub
    </pre>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •