IsLastPage Function in Word VBA

Here’s a handy little function that tells you if the end of a Range in Word VBA lies on the last page of the document:

Function IsLastPage(rng As Word.Range) As Boolean
     IsLastPage = CBool(rng.Information(wdActiveEndPageNumber) = rng.Information(wdNumberOfPagesInDocument))
End Function 

The Range.Information function is very useful. Check it out!

We hope it comes in handy.

Leave a Reply

Your email address will not be published. Required fields are marked *