Reply
 
Thread Tools Display Modes
  #1   Report Post  
Linda
 
Posts: n/a
Default How do I limit word count on a form?

Is there any way to set up constraint for word count? Thanks
  #2   Report Post  
Suzanne S. Barnhill
 
Posts: n/a
Default

You can limit the number of characters, or you can limit the number of lines
by putting a text form field in a table cell with Exact height, but there is
no way (that I am aware of) to limit words.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Linda" wrote in message
...
Is there any way to set up constraint for word count? Thanks


  #3   Report Post  
Greg
 
Posts: n/a
Default

Linda,

If you mean that you want to limit the number of words in a particular
formfield then yes you can use the following series of macros.

Private mstrFF As String
Sub OnExit()
Dim i As Long
Dim myRange As Range

Set myRange = ActiveDocument.Bookmarks("Text1").Range
i = myRange.ComputeStatistics(wdStatisticWords)
With GetCurrentFF
If i 5 Then
MsgBox ("Field word counts exceeds limit of 5.")
mstrFF = GetCurrentFF.Name
End If
End With
End Sub
Public Sub OnEntry()
Dim strCurrentFF As String
If LenB(mstrFF) 0 Then
ActiveDocument.FormFields(mstrFF).Select
mstrFF = vbNullString
End If
End Sub
Private Function GetCurrentFF() As Word.FormField
With Selection
If .FormFields.Count = 1 Then
Set GetCurrentFF = .FormFields(1)
ElseIf .FormFields.Count = 0 And .Bookmarks.Count 0 Then
Set GetCurrentFF = ActiveDocument.FormFields _
(.Bookmarks(.Bookmarks.Count).Name)
End If
End With
End Function

Set the OnExit macro to run when exiting the field you want to
contrain. Set the OnEntry macro in the next formfield in the sequence.

See:
http://www.gmayor.com/formfieldmacros.htm
for more on this method.

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Limit quantities on a form template in Word Leese Microsoft Word Help 1 March 2nd 05 10:01 PM
In typing dates in Word, i.e. "January 12" how do you keep the "1. Carol Microsoft Word Help 2 January 12th 05 08:09 PM
WordPerfect - copying formatting Morgan Page Layout 1 January 10th 05 05:00 PM
saving the workspace Mike Microsoft Word Help 3 December 8th 04 11:32 PM
How do I convert a cd in word perfect to microsoft word greylady Microsoft Word Help 1 November 23rd 04 07:03 PM


All times are GMT +1. The time now is 04:14 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"