J
Jim Burke in Novi
The code you guys gave me to count lines in a document works perfectly,
except for the fact that it counts blank lines at the end of the document.
Sometimes the user must hit the enter key after entering the last name in the
list, and that gets counted. Any simple way to ignore blank lines at the end?
Here's the code I'm using:
Set myDoc = objWord.Documents.Add(dictationServerDir & fileName, , , False)
Set myRange = myDoc.Range
myRange.Find.Execute FindText:="cc:", MatchCase:=True
If myRange.Find.Found Then
myRange.SetRange myRange.End, myDoc.Range.End
SetCopyCount = myRange.Paragraphs.count
If SetCopyCount = 0 Or SetCopyCount > 6 Then
SetCopyCount = 1
End If
Else
SetCopyCount = 1
End If
except for the fact that it counts blank lines at the end of the document.
Sometimes the user must hit the enter key after entering the last name in the
list, and that gets counted. Any simple way to ignore blank lines at the end?
Here's the code I'm using:
Set myDoc = objWord.Documents.Add(dictationServerDir & fileName, , , False)
Set myRange = myDoc.Range
myRange.Find.Execute FindText:="cc:", MatchCase:=True
If myRange.Find.Found Then
myRange.SetRange myRange.End, myDoc.Range.End
SetCopyCount = myRange.Paragraphs.count
If SetCopyCount = 0 Or SetCopyCount > 6 Then
SetCopyCount = 1
End If
Else
SetCopyCount = 1
End If