Hi Paul,
your code example sometimes returns strange results. For example, it returns 10 words for a document which in fact contains 100 words. So I enhanced your script a bit and came up with the following version:
tell application "TextEdit"
activate
set doccont to text of document 1
set docname to name of document 1
set wordcount to length of (words of doccont)
set paracount to length of (paragraphs of doccont)
display dialog "The frontmost document* contains:" & return & return & "Words: " & wordcount & return & "Paragraphs: " & paracount & return & return & "* " & docname buttons {"OK"} default button 1 with title "Text infos for TextEdit"
end tell
This one also counts the paragraphs.
Best regards to South Africa from Germany!