Is there any way to programmatically determine how many lines are in a
paragraph? In addition, is there any way to determine what page(s) a
paragraph lies on, and how many lines of text (not including header and
footers) lie on a given page of a document?

Thanks...

Dan

Re: Figuring out how many lines are in a paragraph by Doug

Doug
Mon Jul 07 22:31:42 CDT 2003

Hi Dan,

See the Selection.Information property. You can use it with the .Range
object as well so set a range equal to the paragraph to get the first line
number, then set the .Start of the Range equal to the .End of the Range to
get the line number of the last line of the paragraph.

Do the same sort of thing with the .Range of the \page bookmark. In this
case though, the line number of the first line will always be 1 so it is
only necessary to determine the line number of the end of the .Range.

Please respond to the newsgroups for the benefit of others who may be
interested.

Hope this helps
Doug Robbins - Word MVP
"Dan" <dan@dontspamme.com> wrote in message
news:ugczBMKRDHA.2636@TK2MSFTNGP10.phx.gbl...
>
> Is there any way to programmatically determine how many lines are in a
> paragraph? In addition, is there any way to determine what page(s) a
> paragraph lies on, and how many lines of text (not including header and
> footers) lie on a given page of a document?
>
> Thanks...
>
> Dan
>
>



Re: Figuring out how many lines are in a paragraph by Helmut

Helmut
Tue Jul 08 03:17:52 CDT 2003

Hi Dan,
try this and change it according to your needs:
Public Function FncLinesInSelection() As Integer
Dim z1 As Integer
Dim z2 As Integer
z1 = Selection.Information(wdFirstCharacterLineNumber)
Set rngTmp = Selection.Range
rngTmp.SetRange _
Start:=rngTmp.End - 1, End:=rngTmp.End - 1
z2 = rngTmp.Information(wdFirstCharacterLineNumber)
FncLinesInSelection = z2 - z1 + 1
End Function

Sub testx()
MsgBox FncLinesInSelection
End Sub

Greetings from Bavaria, Germany
Helmut Weber