Form protection

N

Neil

Hi I have a form in Word that populates with information from a financial
processing application You set up the .dot file by placing for instance
[fname] where you would want the particular customers first name to appear.
There are only a limited number of fields to pre-populate as well as other
areas of the form that the user can either fill out on screen or by hand. I'd
like to be able to allow users to click in a form field and enter the
unavailable data; however, when I set up all the form fields and protect the
document as form the pre populated data stops pre-populating and only shows
the [fname] instead of the actual customers name. I have tried sectioning the
document...same result.
Is there a way to open the form, pre-populate the data and then protect as
form????
Any other suggestions?
 
J

Jay Freedman

Hi Neil,

Yes, that's exactly what you need to do.

If the template is protected, so that a new document based on it is
protected at creation time, then the first thing the populating
procedure needs to do is

myDoc.Unprotect

Then it fills in the pre-populated fields. Finally it should do

myDoc.Protect Type Type:=wdAllowOnlyFormFields

If you need to unprotect and reprotect a form that already has
user-entered data in the form fields, then the .Protect command should
be

myDoc.Protect Type Type:=wdAllowOnlyFormFields, NoReset:=True

to avoid clearing the form fields.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
F

Fred Kruger

Hi Neil

I also use the protection but I also have templates where i want people to
add more text than through a fromfield so i use sections in the document
which can be unprotected.

So i use the following to reprotect a document with different sections in so
all the odd sections are proteced and all evens are un protected if its any
use to you.

Sub reprotect()
Dim sPassword As String

For Each oSection In ActiveDocument.Sections
'If the section's index / 2 <> 0 (odd)
If oSection.Index Mod 2 <> 0 Then
'protection needed
oSection.ProtectedForForms = True
Else
'no protection needed(even)
oSection.ProtectedForForms = False
End If
Next
If lProtected <> wdNoProtection Then
sPassword = "kruger"

ActiveDocument.Protect Type:=lProtected, noreset:=True, Password:=sPassword
End If
End Sub

Fred
 

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