none
Macro to remove all the blank pages in the document RRS feed

Answers

  • Hi,

    Here is a macro to delete all the blank pages in a Word Document for your reference(from Remove Blank Pages from Docx using word interop).

    Sub Demo()
        With ActiveDocument.Content.Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .Text = "^12[^12^13 ]{1,}"
            .Replacement.Text = "^12"
            .Forward = True
            .Wrap = wdFindContinue
            .Format = False
            .MatchWildcards = True
            .Execute Replace:=wdReplaceAll
        End With
    End Sub

    By the way, the program can only effect on the blank page with no paragraph symbol or a Page Break paragraph symbol as the picture below. It can be checked when you click the Show/Hidden symbols button.

    A Page Break paragraph symbol:

    No paragraph symbol:



    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, September 26, 2013 11:02 AM
    Moderator