Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-21-2023, 07:31 AM
Ddadoo57 Ddadoo57 is offline know how to obtain the number of lines written on a given page ? Windows 11 know how to obtain the number of lines written on a given page ? Office 2021
Advanced Beginner
know how to obtain the number of lines written on a given page ?
 
Join Date: Feb 2023
Posts: 73
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
  #2  
Old 06-21-2023, 05:10 PM
Guessed's Avatar
Guessed Guessed is offline know how to obtain the number of lines written on a given page ? Windows 10 know how to obtain the number of lines written on a given page ? Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

There is a special bookmark to work with a range (or select) for a full page
Code:
Sub GetLines()
  Dim rng As Range
  Set rng = ActiveDocument.GoTo(What:=wdGoToPage, Count:=3)
  Set rng = rng.GoTo(What:=wdGoToBookmark, Name:="\page")
  MsgBox rng.ComputeStatistics(wdStatisticLines)
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 06-21-2023, 11:54 PM
Ddadoo57 Ddadoo57 is offline know how to obtain the number of lines written on a given page ? Windows 11 know how to obtain the number of lines written on a given page ? Office 2021
Advanced Beginner
know how to obtain the number of lines written on a given page ?
 
Join Date: Feb 2023
Posts: 73
Ddadoo57 is on a distinguished road
Default

Thanks a lot Guessed, it works great!
Have a nice day,
David
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help making legal line number stay at 25 lines a page when I have sections with single spaced text LegalTranscriber2017 Word 5 07-16-2022 06:50 PM
Moving hand written note from one page to another - or another notebook justpk OneNote 1 05-05-2019 05:55 PM
Grouping Lines by Project number on a separate page taholmes160 Excel 2 04-17-2019 03:57 AM
know how to obtain the number of lines written on a given page ? Customizing number of lines per page Word Rox Word 1 04-05-2015 07:28 PM
Number of lines on page problem JamesT Word 0 08-27-2009 04:52 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:04 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft