Phil Stanton said:
Is there any way of programmatically detecting and removing blank pages from
a document (It is possible that they may have a bookmark on the page)
Thanks
Phil
This should do the trick:
Sub RemoveEmptyLines()
Dim i As Long
' remove manual line breaks first
Call ActiveDocument.Range.Find.Execute(FindText:=Chr(11), ReplaceWith:="", Replace:=wdReplaceAll)
' iterate through the paragraphs, deleting those that are empty
For i = ActiveDocument.Paragraphs.Count To 1 Step -1
If ActiveDocument.Paragraphs(i).Range.Characters.Count = 1 Then ..Delete
Next i
End Sub
Might need a little tweaking, but it's the basic operation.
hth,
-Peter