Few Question about Line Numbers

V

VBALover

Hi all,

how can I find
1) current line numbers?

2) total line numers?


Thanks

Regards
 
C

Cindy M -WordMVP-

Hi VBALover,
how can I find
1) current line numbers?
I think the Information property for Selection or Range
will give you this
2) total line numers?
I'm not sure you can get this, however. From
ComputeStatistics you can get the total number of lines,
but that may differ from what you're after...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
K

Klaus Linke

Hi VBALover,

1)
For the current line number at the start of the selection (line on the page,
as displayed in the status bar):
? Selection.Information(wdFirstCharacterLineNumber)

If you show line numbers on the page, it may be difficult to find the line
number that's actually displayed, since line numbers can be restarted on
each page, at section breaks, or they can be continuous. Also, line
numbering can be suppressed for some section, or for some paragraphs, or
paragraph styles.

2)
? ActiveDocument.Range(0,Selection.End).ComputeStatistics(wdStatisticLines)
would give you a running total up to the end of the current selection,
and
? ActiveDocument.Content.ComputeStatistics(wdStatisticLines)
the total for the main document (without text boxes, footnotes, comments,
headers and footers).

Regards,
Klaus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top