Re: Wordcount in tables

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi John,

Text in cell(1,1) is "Red Brown"

Sub Test04()
With ActiveDocument.Tables(1).Cell(1, 1).Range
MsgBox .ComputeStatistics(wdStatisticWords)
End With
End Sub

returns 0 (zero) :-(

But as selection is often faster in tables anyway,
you may google for my decent name and "selection table speed",
or similar, if you like.

I'd recommend something like that:

Sub Test04a()
With ActiveDocument.Tables(1).Cell(1, 1).Range
..Select
Selection.End = Selection.End - 1
MsgBox Selection.Range.ComputeStatistics(wdStatisticWords) ' 2
End With
End Sub

HTH

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"






.



Relevant Pages