We have created a document thatputs in demographics automatically. In order
to make this work, the document cannot be protected. After the demographics
are fed in, I need to protect the document to make the rest of the form
usable to our staff. I would like to enter VBA code into an autoopen macro
that already feeds the demographics into the doc. My boss does not want staff
to be able to touch anything but the fields. Thanks for any assistance.
Patti
G'day "Patti" <Patti@discussions.microsoft.com>,
I would be happy to provide this service commercially if you need a
solution.
Steve Hudson - Word Heretic
steve from wordheretic.com (Email replies require payment)
Without prejudice
Patti reckoned:
>We have created a document thatputs in demographics automatically. In order
>to make this work, the document cannot be protected. After the demographics
[quoted text clipped - 3 lines]
>to be able to touch anything but the fields. Thanks for any assistance.
>Patti
Ben M - 24 Jun 2005 09:42 GMT
I thought this was a forum to help people, not to peddle your business. You
should be ashamed Steve Hudson.
> G'day "Patti" <Patti@discussions.microsoft.com>,
>
[quoted text clipped - 15 lines]
> >to be able to touch anything but the fields. Thanks for any assistance.
> >Patti
Patti,
Here is some code that I had used to protect/unprotect a document. You can
also use a password as I have done. I have also checked if the document is
protected before I unprotect it etc.
Hope this free help is of use.
' // --------------------------------- //
' // UnprotectDocument //
' // --------------------------------- //
Sub UnprotectDocument()
On Error Resume Next
If ActiveDocument.ProtectionType = wdNoProtection Then
Debug.Print
Else
ActiveDocument.Unprotect Password:="password"
End If
End Sub
' // --------------------------------- //
' // ProtectDocument //
' // --------------------------------- //
Sub ProtectDocument()
On Error Resume Next
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True,
Password:="password"
Else
Debug.Print
End If
End Sub
The just call the sub you want.
Call ProtectDocument 'example how to call
> We have created a document thatputs in demographics automatically. In order
> to make this work, the document cannot be protected. After the demographics
[quoted text clipped - 3 lines]
> to be able to touch anything but the fields. Thanks for any assistance.
> Patti
Patti - 24 Jun 2005 15:26 GMT
Thank you Ben. It works perfectly. I appreciate your assistance and that you
did not charge me!
Patti
> Patti,
>
[quoted text clipped - 45 lines]
> > to be able to touch anything but the fields. Thanks for any assistance.
> > Patti
Doug Robbins - 24 Jun 2005 21:18 GMT
While your subject of your post just talked about protecting the document,
the body of it talked about a macro to import the demographics. It was
almost certainly that part to which Steve was referring.

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Thank you Ben. It works perfectly. I appreciate your assistance and that
> you
[quoted text clipped - 53 lines]
>> > to be able to touch anything but the fields. Thanks for any assistance.
>> > Patti
Word Heretic - 25 Jun 2005 06:22 GMT
G'day "Ben M" <aa@ozemail.com.au>,
Ok, so you've done 10% of the job - now finish it.
Steve Hudson - Word Heretic
steve from wordheretic.com (Email replies require payment)
Without prejudice
Ben M reckoned:
>Patti,
>
[quoted text clipped - 45 lines]
>> to be able to touch anything but the fields. Thanks for any assistance.
>> Patti
Patti - 27 Jun 2005 14:26 GMT
Ben, it works perfectly. I have the other 90%, I think
> G'day "Ben M" <aa@ozemail.com.au>,
>
[quoted text clipped - 56 lines]
> >> to be able to touch anything but the fields. Thanks for any assistance.
> >> Patti
Word Heretic - 27 Jun 2005 15:57 GMT
G'day "Patti" <Patti@discussions.microsoft.com>,
So why did you ask for it?
Steve Hudson - Word Heretic
steve from wordheretic.com (Email replies require payment)
Without prejudice
Patti reckoned:
>Ben, it works perfectly. I have the other 90%, I think
>
[quoted text clipped - 58 lines]
>> >> to be able to touch anything but the fields. Thanks for any assistance.
>> >> Patti
Ben M - 30 Jun 2005 11:41 GMT
Patti, I am glad this works for you.
Word Heretic... For someone that charges money to do VBA, you sure have
problems reading plain English.
Perhaps you should re-read the question (and maybe read it again). You
might then realise that the demographic import has already been done,
leaving the original question on how to protect/unprotect the document.
It's common for people requesting *help* to set the scene in what they are
trying to achieve. This is simply what Patti did.
What part of "We _have created_ a document that puts in demographics
automatically" did you not understand??
Kind Regards, Ben
> G'day "Patti" <Patti@discussions.microsoft.com>,
>
[quoted text clipped - 69 lines]
> >> >> to be able to touch anything but the fields. Thanks for any assistance.
> >> >> Patti