View Single Post
  #2   Report Post  
Posted to microsoft.public.word.newusers
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Making users fill in the form in Word

Hi lorican,

If you place the following vba code in the 'ThisDocument' module, it will prevent the document being closed if it contains any
formfields that have not been filled in.

Private Sub Document_Close()
Dim oFld As FormField
For Each oFld In ActiveDocument.FormFields
If Trim(oFld.Result) = "" Then
MsgBox "Please complete all the items"
ThisDocument.Reload
Exit Sub
End If
Next aField
End Sub

Note: If the user disables macros upon loading the document or their macro security setting is too high, the code won't work and
they'll be able to close the document without filling in all the formfields.


--
Cheers
macropod
[MVP - Microsoft Word]


"lorican" wrote in message ...

Hello, I've got a form that I send out to our partners, but the problem
is that more often than not, they return the form not fully completed.
How can I make it that, if they don't fill in part of the form it will
not let them save it? or an 'alert' message will pop up? Various other
companies do similarl things in various online forms, where you can not
submit the form if you have not filled in all the parts. I know there is
also a way of doing it in Excel, but I don't know how. If someone could
tell me how to do it in Word and/or Excel, I'd be very greatful.

Thank you.




--
lorican