L
Larry
I'm wondering if I can get any further help on this. Martinique tried
bravely to help but we ran into a wall. According to VBA help in Word
97, this code should count the number of words in the range, which in
this case is the selection. My test code below follows the sample
presented in help. Yet, as I discussed with martinique, the resuling
number is only occasionally correct. Most of the time it's much lower
(sometimes higher) than the correct number. I tried it on another
computer, and it wouldn't work there either. Meanwhile, Martinique
tried it over and over, and it was always correct.
Since I'm following the Help sample so closely, I can't see what I'm
doing wrong. Does anyone have any ideas of why this is not working?
Dim r As Range
Set r = Selection.Range
WordCount = r.ComputeStatistics(Statistic:=wdStatisticWords)
MsgBox "Words in selection: " & WordCount, vbOKOnly, "Word
Counter"
bravely to help but we ran into a wall. According to VBA help in Word
97, this code should count the number of words in the range, which in
this case is the selection. My test code below follows the sample
presented in help. Yet, as I discussed with martinique, the resuling
number is only occasionally correct. Most of the time it's much lower
(sometimes higher) than the correct number. I tried it on another
computer, and it wouldn't work there either. Meanwhile, Martinique
tried it over and over, and it was always correct.
Since I'm following the Help sample so closely, I can't see what I'm
doing wrong. Does anyone have any ideas of why this is not working?
Dim r As Range
Set r = Selection.Range
WordCount = r.ComputeStatistics(Statistic:=wdStatisticWords)
MsgBox "Words in selection: " & WordCount, vbOKOnly, "Word
Counter"