Hi all,

I have a document generated by userform - as a lot of text is deleted due to choices made by the user in the userform, it often leaves blank pages at the end of the document.

Does anyone have any experience of deleting blank pages like this? Ideally I would need to be able to delete blank pages up until the point that there is a page with text. It would run at the end of the userform to essentially clean up the doc.

Public Function DeleteBlankPages(wd As Word.Document)      
Dim par As Paragraph
    For Each par In wd.Paragraphs
        If Len(par.Range.Text) <= 1 Then
            par.Range.Delete
        End If
    Next par       
End Function
I found the above online, but doesn't seem to work for me...

Any thoughts would be gratefully received.

Thanks,
AJHEZ