|
Transcriptionists often ask "How do I get an accurate count of
lines in my document that actually contain text?"
The Word menu command
Tools>Word Count generates a report listing the number of lines in a
document. The reports qualifies “all lines.” This includes lines that
are empty but still available for holding text. There is a difference
between an empty line (which is counted) and space between lines, which
isn't. |
|
 |
|
Have a look at the two
samples of text below. They both look the same and they both appear to
have 4 lines of text. However, a line count report using Tools>Word
Count with the first example selected would result in 5 counted lines.
A frustrating and inaccurate count for the transcriptionists. A line count of the
second example would result in 4. |
|

|
|
What is
the difference? The first example contains an empty line. Toggle
display of non-printing characters CTRL+SHIFT+* and you will see in the
first example the ¶ paragraph symbol marking an empty line 3. Is line 3
capable of holding text? You bet. Empty lines are a result of
undisciplined formatting. It is very easy and generally a bad habit to
create
space between lines by pounding the enter key.
You are not only generating space; you are also adding empty paragraphs, which
count as lines. The second sample on the other hand uses disciplined
paragraph formatting to add space between paragraphs. The example is
formatted with the menu command Format>Paragraph>Indents and
Spacing>Spacing Before 12 pt. This format adds a 12 pt space before
each new paragraph. As an alternative, you can quickly apply this
formatting with the keyboard shortcut CTRL+0. |
|

|
|

|
|
Line Counting Macros. Disciplined formatting should
eliminate most of your problems with accurate line counting.
However, if you refuse to get onboard, I have put together a few macros
to overcome the error induced by undisciplined formatting. |
| 1. The macro first eliminates empty lines created by
undisciplined use of the enter key. It then performs and reports a
line count. Finally empty lines are restored in the document.
Sub CountLinesOfText() Dim NumLines As Long
With ActiveDocument.Range.Find
.ClearFormatting
.Format = False
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
.Text = "[^13]{2,}"
.Replacement.Text = "^p"
.Execute Replace:=wdReplaceAll
.Text = "[^l]{2,}"
.Replacement.Text = "^l"
.Execute Replace:=wdReplaceAll
.Text = "^13^l"
.Replacement.Text = "^p"
.Execute Replace:=wdReplaceAll
.Text = "^l^l3"
.Replacement.Text = "^p"
.Execute Replace:=wdReplaceAll End With NumLines = ActiveDocument.ComputeStatistics(wdStatisticLines) ActiveDocument.Undo 'ActiveDocument.Undo MsgBox ("The document contains " & NumLines & " Lines") Selection.HomeKey wdStory End Sub |
| 2. The second macro counts lines of qualified
length. It is pre-set to skip counting lines that are one character
(i.e., a paragraph mark or line break marker) and lets you specify a
qualifier. For example, if you wanted to skip all lines of three or
fewer characters then you enter 3 in the input box when the macro runs.
Sub CountQualifiedLines()
Dim CharCount As Integer
Dim tCount As Integer
Dim LineCount As Integer
Dim Qualifier As String
Qualifier = InputBox("Enter minimum line length:", "Line Length", 1)
tCount = ActiveDocument.ComputeStatistics(wdStatisticLines)
Selection.HomeKey wdStory
Do While tCount > 0
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
CharCount = Selection.Characters.Count
tCount = tCount - 1
If CharCount > Qualifier Then
LineCount = LineCount + 1
End If
Selection.Collapse wdCollapseStart
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Loop
Selection.HomeKey wdStory
MsgBox "There are " & LineCount & " qualified lines in this document"
End Sub |
|
Need help applying macros? See fellow MVP Graham
Mayor's
Guide for
Installing Macros |
|
|
Looking for something else?
|
|
|
|
|