Limiting the Number of Words

K

klav

I would like to limit the number of words in a particular section of a
document to 90 words. The document is not set up as a form. Is there a way to
do this?

If that is not possible, I would at least like to alert the user how many
words are contained in this particular section. I know there is a {numwords}
field but can this be used only for one specific section? Also, do you have
any suggestions for implementing this -- I would like the user to know as
they are entering/deleting text how many words have been entered rather than
having a macro that executes a field update when they attempt to save or
close the document. Thanks in advance for your help.
 
J

Jean-Guy Marcil

klav was telling us:
klav nous racontait que :
I would like to limit the number of words in a particular section of a
document to 90 words. The document is not set up as a form. Is there
a way to do this?
No.

If that is not possible, I would at least like to alert the user how
many words are contained in this particular section. I know there is
a {numwords} field but can this be used only for one specific
section? Also, do you have any suggestions for implementing this --
I would like the user to know as they are entering/deleting text how
many words have been entered rather than having a macro that executes
a field update when they attempt to save or close the document.
Thanks in advance for your help.

This would take a lot of heavy and complicated code in class and standard
modules....

You could, at the start of the said section, include a MacroButton field:
{MACROBUTTON SectionWordCount Count}
(where the {} are typed in by doing CTRL-F9)
and use this macro:

'_______________________________________
Sub SectionWordCount()

'-1 to remove the word form the macrobutton field
MsgBox
CStr(Selection.Sections(1).Range.ComputeStatistics(wdStatisticWords) - 1)

End Sub
'_______________________________________

Now the user just has to double click on the field to get the word count.

You could link the macro to a toolbar button instead, in which case, remove
the "- 1" from the code and tell the user to place the cursor in the
appropriate section before clicking on the button.

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top