View Single Post
  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Required Fields in Word Forms

If the user is closing the form, what difference does it make whether the
form is completed or not?
You could for example intercept the save command with the following macro in
the same template module -

Public Sub FileSave()
Dim orng As Word.Range
Dim ofld As FormFields

Set orng = ActiveDocument.Range
Set ofld = orng.FormFields

For i = 1 To ofld.Count
ofld(i).Select
If ofld(i).Result = "" Then
MsgBox "All fields must be completed"
Exit Sub
End If
Next i
ActiveDocument.Save
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



TechWriter wrote:
Thanks Graham.

This code prompts the user on exit from the field. Is there a way to
prompt the user to complete any required field when closing the form
and prevent the user from closing the form without completing the
required field?

Thanks in advance.

"TechWriter" wrote:

How do I make text boxes required fields in a Word form? e.g.,
Require a user to complete a particular field and display a
notification message when the user tries to save the message without
completing the required field.

Thank you for your help.