So what I'm trying to do is on an open word document using excel vba, I'm trying to go through each page of the word document and if the length of the range on any page is less than or equal to 20 (20 being the length of the subtitle that is bookmarked and then a page break is performed, leaving a blank page and 20 character spaces) then delete the page as it holds no content.
The following is what I have right now, but it doesnt work.
Dim Rng As Range, i as Long
For i = 1 To wdDoc.ComputeStatistics(wdStatisticPages)
Set Rng = wdDoc.Goto(What:=wdGoToPage, Name:=i)
Set Rng = Rng.Goto(What:=wdGoToBookmark, Name:="\page")
If Len(Rng) <= 20 Then Rng.Delete
Next i