Hi I'm working in Word 2002.
My team and I create templates for our Agency to use. These templates are
protected so the user can complete the fields. What is happening is the
users are unprotecting the documents and altering the form contents.
How can or can I, create a macro that will close the form out if the user
either clicks on the protect button on the Forms toolbar or if they click on
Tools, Unprotect Document?
Thanks for your assistance.
The simplest thing is to apply a password when you protect the template. That
way, no one can unprotect a document based on the template unless they have
the password. (I hesitate to tell you how easy it is to bypass this password
protection, but most users don't know the trick so you're probably safe.)
By writing macros with the names of the corresponding internal commands, you
can intercept the menu and button and take whatever action you want. (See
http://www.word.mvps.org/FAQs/MacrosVBA/InterceptSavePrint.htm.)
The button on the Forms toolbar is intercepted by any macro named ProtectForm.
The menu item on the Tools menu in Word 2002 and 2003 is intercepted by a
macro named ToolsProtect. The same item in Word 2000 (and probably in Word
97, but I don't have that handy) is intercepted by a macro named
ToolsProtectUnprotectDocument.
I don't think suddenly closing the form is a good action to take in these
macros -- you'll get a lot of support calls complaining that "you broke
Word". If you leave the macro's body empty, clicking the button or menu item
will simply do nothing. Alternatively, you could display a messagebox that
says something like "Altering this form is prohibited" or "Touch that button
again and you're fired!"
If your users have Word 2002/2003, there is no macro method to intercept the
user opening any task pane, switching to the Protect Document pane, and
clicking the Stop Enforcing Protection button. Requiring a password is the
only way to stop that approach.

Signature
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
> Hi I'm working in Word 2002.
>
[quoted text clipped - 7 lines]
>
> Thanks for your assistance.
Jamie - 28 Mar 2006 18:23 GMT
Hi Jay, I went to the InterceptSavePrint link you provided and I'm not sure
how to alter that coding to fit my situation. I understand I'll need two
macros; one for the button - ProtectForm and the other for the Tools Menu -
ToolsProtect.
I'm just not sure about the coding. Any help you can give me to get started
would be great.
Thanks,

Signature
Jamie
> The simplest thing is to apply a password when you protect the template. That
> way, no one can unprotect a document based on the template unless they have
[quoted text clipped - 35 lines]
> >
> > Thanks for your assistance.
Jay Freedman - 29 Mar 2006 04:44 GMT
As I wrote before, if you simply want to disable the unprotect
commands, you create the two macros but leave them empty:
Sub ProtectForm
End Sub
Sub ToolsProtect
End Sub
If you want to give the user some clue about why the commands don't
work, insert a MsgBox statement inside each macro.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
>Hi Jay, I went to the InterceptSavePrint link you provided and I'm not sure
>how to alter that coding to fit my situation. I understand I'll need two
[quoted text clipped - 45 lines]
>> >
>> > Thanks for your assistance.
Jamie - 29 Mar 2006 17:40 GMT
Oh, sorry you had to spell it out for me Jay. I didn't catch the leave them
empty part. I'll give it a try. Thanks again.

Signature
Jamie
> As I wrote before, if you simply want to disable the unprotect
> commands, you create the two macros but leave them empty:
[quoted text clipped - 64 lines]
> >> >
> >> > Thanks for your assistance.