remove extra blank lines

  • Hi, everbody
    Could you pls tell me how i can write a macro to remove the lines that are just a blank line with no word or character around in a large document

    thanks


  • :)
    Hello NateO
    Very thanks and appreciate for your help .
    it worked fine .

    Sincerely yours


  • Hello, I assume you mean trim paragraph breaks. Depends how many consecutive breaks you have. If it's always 1, the first should fire, if multiple, you'll probably want the second variety:

    Sub MightWork()
    ThisDocument.Content.Find.Execute "^p^p", , , , _
        , , True, wdFindContinue, , "^p", wdReplaceAll
    End Sub

    Sub AlwaysWorks()
    Dim p As Paragraph
    For Each p In ThisDocument.Paragraphs
       If Len(p.Range) = 1 Then p.Range.Delete
    Next p
    End Sub


    Hope this helps.