Paul_Hossler
09-15-2016, 07:56 PM
If I select the red paragraph, and then control-click the green paragraph to have 2 non-contiguous text ranges selected, my simple word count macro
17089
Option Explicit
Sub WordCount()
Dim iWords As Long
With Selection
Call MsgBox( _
"There are:" & vbCrLf & vbCrLf & _
" Characters : " & Format(.Characters.Count, "#,##0") & vbCrLf & _
" Words : " & Format(.Words.Count, "#,##0") & vbCrLf & _
" Sentences : " & Format(.Sentences.Count, "#,##0") & vbCrLf & _
" Paragraphs : " & Format(.Paragraphs.Count, "#,##0"), vbInformation + vbOKOnly, "Selection Statistics")
End With
End Sub
only report the last (green) paragraph
I know Word is smart enough to realize that there are 2 pieces to the Selection (make Bold gets both), but is there a Word equivalent to Excel's .Area that will allow accurate counts?
17089
Option Explicit
Sub WordCount()
Dim iWords As Long
With Selection
Call MsgBox( _
"There are:" & vbCrLf & vbCrLf & _
" Characters : " & Format(.Characters.Count, "#,##0") & vbCrLf & _
" Words : " & Format(.Words.Count, "#,##0") & vbCrLf & _
" Sentences : " & Format(.Sentences.Count, "#,##0") & vbCrLf & _
" Paragraphs : " & Format(.Paragraphs.Count, "#,##0"), vbInformation + vbOKOnly, "Selection Statistics")
End With
End Sub
only report the last (green) paragraph
I know Word is smart enough to realize that there are 2 pieces to the Selection (make Bold gets both), but is there a Word equivalent to Excel's .Area that will allow accurate counts?