Count of lines in separate text column

V

viter.alex

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
 
P

Peter Jamieson

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
 

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