View Single Post
 
Old 06-21-2023, 07:31 AM
Ddadoo57 Ddadoo57 is offline Windows 11 Office 2021
Advanced Beginner
 
Join Date: Feb 2023
Posts: 90
Ddadoo57 is on a distinguished road
Default know how to obtain the number of lines written on a given page ?

Hello,
Does anyone know how to obtain the number of lines written on a given page (numPage)?

The following code only works if "numPage + 1" exists.

Set startPage = ActiveDocument.GoTo(What:=wdGoToPage, Count:=numPage)
Set endPage = ActiveDocument.GoTo(What:=wdGoToPage, Count:=numPage + 1)
endPage.Collapse Direction:=wdCollapseEnd

MsgBox ActiveDocument.Range(startPage.Start, endPage.Start).ComputeStatistics(wdStatisticLines)


Thank you very much for your feedback.

Yours sincerely
David
Reply With Quote