Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    May 2009
    Posts
    16
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Nuisance Line Breaks in Middle of Sentences when Pasting from Websites

    I frequently copy recipes from websites into Word 2003 Templates, which I created in order to save ink. I then convert them to PDF format to save space on my drive.

    Many sites have formatting that trouble me. When I paste them, even with a no-format paste macro, the body of the text pastes sort of, column-like. The text does not cover the entire width of the page before it breaks to the next line.

    Is there a shortcut to joining the sentences, like the “Join” button in NoteTab Lite?

    When I paste those recipes, if there are a lot of lines, I paste them first into NoteTab, click the “join” button, and then paste them back into the Word Template.

    If there are only a few lines, I place the cursor in front of the next line and back it up to the beginning of the break on the previous line, which is very time consuming.
    Last edited by bigbro51; 2011-08-30 at 18:20.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    First, if you don't normally display non-printing characters, click the button to display them.

    Can you confirm that there is a manual line break between lines and not a paragraph? If so, you could use Find and Replace to change those to a space. However, if the paragraph breaks were done with two consecutive manual line breaks, then you would first want to replace those with a paragraph break. The symbols for finding and replacing are ^l (lower case L) and ^p respectively.

    If that works, you could record the steps as a macro.

  3. The Following User Says Thank You to jscher2000 For This Useful Post:

    bigbro51 (2013-01-09)

  4. #3
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts
    On a copy, try AutoFormat. You may have to tweak the options. I seldom use it but this situation is one of the reasons for the feature.
    Charles Kyle Kenyon
    Madison, Wisconsin

  5. The Following User Says Thank You to Charles Kenyon For This Useful Post:

    bigbro51 (2013-01-09)

  6. #4
    New Lounger
    Join Date
    May 2009
    Posts
    16
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Charles Kenyon View Post
    On a copy, try AutoFormat. You may have to tweak the options. I seldom use it but this situation is one of the reasons for the feature.
    I wish I could remember a site that formats the way I mentioned at this time, so that I can try both these methods. However, jscher2000 will have to help me with his, or her, suggestion, cause I have no clue as to what those expressions are. I'm not that familiar with Office. I've learned to make simple macros and place them on toolbars. I've learned to make simple templates too, with the emphasis on simple. That's why I'm asking you guys for help. I will try them and get back with you here, God willing.

    Gratefully,
    bigbro51

  7. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Here's a macro I use:
    Code:
    Sub CleanUpPastedText()
    Dim TrkStatus As Boolean      ' Track Changes flag
    ' Turn Off Screen Updating
    Application.ScreenUpdating = False
    With ActiveDocument
    ' Store current Track Changes status, then switch off
      TrkStatus = .TrackRevisions
      .TrackRevisions = False
      With .Content.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
        'Find any paragraph mark with text either side
        .Text = "([!^13])([^13])([!^13])"
        'Replace the paragraph mark with a space
        .Replacement.Text = "\1 \3"
        .Execute Replace:=wdReplaceAll
        'Find multiple consecutive spaces
        .Text = "([ ])[ ]{1,}"
        'Replace with a single space
        .Replacement.Text = "\1"
        .Execute Replace:=wdReplaceAll
        'Find multiple consecutive paragraph breaks
        .Text = "[^13]{2,}"
        'Replace with a single paragraph break
        .Replacement.Text = "^p"
        .Execute Replace:=wdReplaceAll
        'Convert any unix-style paragraph breaks to Word paragraph breaks
        .Text = "[^13]"
        .Execute Replace:=wdReplaceAll
      End With
      ' Restore original Track Changes status
      .TrackRevisions = TrkStatus
    End With
    ' Restore Screen Updating
    Application.ScreenUpdating = True
    End Sub
    Note: the macro assumes each real paragraph is separated by two or more paragraph breaks. To make the macro work only on a selected block of text, change:
    With .Content.Find
    to:
    With Selection.Find
    and change:
    .Wrap = wdFindContinue
    to:
    .Wrap = wdFindStop
    Last edited by macropod; 2011-09-09 at 09:13.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  8. The Following User Says Thank You to macropod For This Useful Post:

    bigbro51 (2013-01-09)

  9. #6
    New Lounger
    Join Date
    May 2009
    Posts
    16
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by macropod View Post
    Here's a macro I use:
    ... snip
    Note: the macro assumes each real paragraph is separated by two or more paragraph breaks. To make the macro work only on a selected block of text, change:
    ... snip
    Thanks. I'll create two macros with this code and try them next time I find it pasting the truncated sentences.

  10. #7
    New Lounger
    Join Date
    May 2009
    Posts
    16
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Thank you all!

Posting Permissions

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