Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 11-27-2022, 05:10 AM
gmayor's Avatar
gmayor gmayor is offline Detecting_paragraph Windows 10 Detecting_paragraph Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You could use the following function to count the number of lines in a range
Code:
Function NumLines(Rng As Range) As LongPtr
'Graham Mayor - http://www.gmayor.com
Const wdStatisticLines As LongPtr = 1
    NumLines = Rng.ComputeStatistics(wdStatisticLines)
lbl_Exit:
    Exit Function
End Function
Call it from your process e.g.
Code:
Sub macro1()
MsgBox NumLines(Selection.Paragraphs(1).Range)
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 

Thread Tools
Display Modes


Other Forums: Access Forums

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


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