View Single Post
 
Old 06-18-2012, 07:53 AM
Ulodesk Ulodesk is offline Windows 7 64bit Office 2010 64bit
Word 2013 Expert Cert
 
Join Date: Sep 2009
Location: Virginia
Posts: 872
Ulodesk is on a distinguished road
Default Macro

Thank you, Paul, but the macro you provided doesn't seem to work -- though I am relcutant to even suggest this. Perhaps I have once again managed to state my problem unclearly. I copied your macro into my VBA and ran it on five selected paragraphs (single lines I had created, each with a hard return), which start several paragraphs down (see attached document). Like my previous, recorded macro, it did not stop with those five lines but continued all the way to the end of the document, merging 20 paragraphs, reporting this, and asking if I wished to check the rest of the document.

In between the time I posted my question and received your reply, I had tried one other thing over the weekend, on a guess, which was to make Wrap false, which work did work. I was going to post this this morning when I saw that you had replied, so I tried yours first. The working macro now reads thus, with a few superfluous lines removed, per your example:
Code:
Sub ParasStripSelected()
'
' ParasStripSelected Macro
'
'
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "^p"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = False
        .Format = False
        .MatchCase = False
        .MatchWildcards = False
        .Execute Replace:=wdReplaceAll
    End With
End Sub
Attached Files
File Type: docx Lorem ipsum dolor sit ame1.docx (18.1 KB, 12 views)
Reply With Quote