Emails, text copied from the web, or documents prepared by those that use Word as a typewriter often have paragraph marks (technically, pilcrows, ¶) at the end of each line, with two between "paragraphs":
This can be very irritating when you're trying to make text flow, the way a Word document should
You can remove these manually (click the
button, on the Standard toolbar to see the paragraph marks if they're not visible):You can automate this very easily. Here's one way:
Public Sub ReplaceParagraphMarks() 'J.E. McGimpsey 'http://www.mcgimpsey.com/macoffice/word/replaceparas.html Const sREPLACE As String = "!_REPLACE_RETURN_TEXT_!" Application.ScreenUpdating = False With ActiveDocument.StoryRanges(wdMainTextStory).Find .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .ClearFormatting .Text = "^p^p" With .Replacement .ClearFormatting .Text = sREPLACE End With .Execute Replace:=wdReplaceAll .Text = vbNewLine .Replacement.Text = " " .Execute Replace:=wdReplaceAll .Text = sREPLACE .Replacement.Text = "^p" .Execute Replace:=wdReplaceAll End With Application.ScreenUpdating = True End Sub
This page last updated on
© Copyright 2001 - 2004 McGimpsey and Associates. Except where noted, all code on this site may be distributed under the Gnu GPL. Acknowledgement is appreciated.