View Single Post
  #1 (permalink)  
Old September 21st, 2013, 01:42 PM
tfurnivall tfurnivall is offline
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Counting line numbers in a section

I'm trying to get the number of lines in a section. I'd rather not loop through the lines if at all possible. So I tried using the following Code snippet:
Code:
Set MySection = ActiveDocument.Sections(s)
MySection.Range.Select
Debug.Print "Section"; s; " starts in line"; Selection.Information(wdFirstCharacterLineNumber)
I'm passing in a section number (s) to this procedure. Unfortunately the method returns only the line number within the section of the first character in the selection. Since I'm selecting the whole range, this will always be 1. (I suppose it could have been 0, but ....nah, don't go there ;-)

Has anybody else solved this problem?

Thanks,

Tony
Reply With Quote