Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Count of lines in separate text column

2 views
Skip to first unread message

viter.alex

unread,
Dec 17, 2009, 2:27:26 AM12/17/09
to
I'm confused with count of lines in the range in the separate text
column different from the first. Here is macro sample:
Sub test()
ActiveDocument.PageSetup.TextColumns.Add CentimetersToPoints(7), ,
False
Debug.Print InsertText("first " & String(500, "a")).ComputeStatistics
(wdStatisticLines)
Selection.InsertBreak wdColumnBreak
Debug.Print InsertText("second " & String(500,
"b")).ComputeStatistics(wdStatisticLines)
Selection.InsertBreak wdColumnBreak
Debug.Print InsertText("third " & String(500, "c")).ComputeStatistics
(wdStatisticLines)
End Sub

Function InsertText(TextString As String) As Range
Dim nStart As Long
Dim nEnd As Long

nStart = Selection.Start
Selection.TypeText TextString

nEnd = Selection.End
Set InsertText = ActiveDocument.Range(nStart, nEnd)
End Function

As you can see returned count of lines doesn't correspond to reality

Peter Jamieson

unread,
Dec 18, 2009, 5:17:38 PM12/18/09
to
1. I get 14,15,12
2. I see 14,16,12

I would regard the values returned by .ComputeStatistics as
"approximations" rather than proper statistical values, i.e. "facts".
Clearly if they are approximations it would be useful to have some info.
about the possible margin of error/spread but I don't think
we get that either.

Peter Jamieson

http://tips.pjmsn.me.uk

0 new messages