Thread: [Solved] Delete blank pages
View Single Post
 
Old 09-07-2014, 02:37 AM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

If they are just paragraph breaks at the end then

Code:
Sub Macro1()
Dim i As Long
    For i = ActiveDocument.Paragraphs.Count To 1 Step -1
        If Len(ActiveDocument.Paragraphs(i).Range) = 1 Then
            ActiveDocument.Paragraphs(i).Range.Delete
        Else
            Exit For
        End If
    Next i
End Sub
As for the compiler error with the previous macro, you have a missing object library reference - Microsoft Forms 2.0

If you change
Dim dFname As DataObject
to
Dim dFname As Object

it should compile.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote