How to perform a "pseudo" ActiveDocument.protect

B

barnettj68

I have a need to prevent changes from being made to an ActiveDocument.
The limitation is I'm trying to "band-aid" a 3rd party application. It
breaks if the ActiveDocument is protected. I know that I can capture
the user moving the mouse (i.e making a selection) via
WindowSelectionChange event. How can I then prevent the user from
making any changes or additions (pseudo-protect)? Is there a built-in
macro(s) that I could override?
 
D

Dawn Crosier

When you load the ActiveDocument, you can protect it by adding
the following code to the startup of your document.

Sub proToggleFormLock()

'Toggle the Protection on and off

If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then

ActiveDocument.Unprotect Password:="myPassword"

Else

ActiveDocument.Protect Password:="myPassword", NoReset:=True,
Type:= _

wdAllowOnlyFormFields

End If

End Sub



I am not aware of any built-in macro's which would help you with
what you want to do other than to increase the security level to
High or Very High depending on the version of Word you are
running.


--
Dawn Crosier
Microsoft MVP
"Education Lasts a Lifetime"

This message is posted to a newsgroup. Please post replies and
questions to the newsgroup so that others can learn as well.

I have a need to prevent changes from being made to an
ActiveDocument.
The limitation is I'm trying to "band-aid" a 3rd party
application. It
breaks if the ActiveDocument is protected. I know that I can
capture
the user moving the mouse (i.e making a selection) via
WindowSelectionChange event. How can I then prevent the user
from
making any changes or additions (pseudo-protect)? Is there a
built-in
macro(s) that I could override?
 
B

barnettj68

Unfortunately the 3rd party's ActiveX control that integrates with Word
fails when the ActiveDocument is protected via ActiveDocument.Protect.
Thus the need to override the ability to edit, delete, or insert text
when the WindowSelectionChange event fires.
 

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