Unprotecting and Protecting Document via mouse click on active pag

B

Brendan

I have a two page template in which the first page contains nothing but
tables and the second and every page there after contains a repeating header
and footer (but not shown on the first page). I have the concept of document
protection and have created a bookmark called bmDocNarrative and inserted it
on Page 2 where I want the user to start typing.

When the template is opened into a document, it is protected and the user
fills in the fields based on Form Fields. When the user tabs out of the last
form field on Page 1, there is an on exit macro which unprotects the document
and goes to the said bookmark so the user can start typing the narrative.

My question is if the user arrows or mouse clicks their way back to page
one, all of the tables are now “unlocked†because the document is
unprotected. What would some simple code be to force the document back into
protection mode while Page 1 is active and to unlock it if the user tries to
click back into the text (or page 2 or any other page than page 1)? Or am I
making this too complicated?
 
B

Brendan

I know the below code works for the entire document but what would the code
be for just the section?

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

Jezebel

Brendan said:
I know the below code works for the entire document but what would the code
be for just the section?

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

Jean-Guy Marcil

Brendan was telling us:
Brendan nous racontait que :
I know the below code works for the entire document but what would
the code be for just the section?

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

As you wrote, this code will lock/unlock the whole document.

If you already tagged some sections to be protected, than only those
sections will be affected by the locking/unlocking.

So, when you create the template, manually assigned which sections need
protecting and which don't.
Then, in code, you can lock/unlock as you want, and only the concerned
sections will lock/unlock.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
B

Brendan

The section break works fine but I cannot get from page 1 to page 2 via an on
exit macro from the last field. This macro goes to a bookmark for the
narrative. The macro tests fine when the section or document is not
protected but from within the protected section, it does not work. My Goal is
to have page 1 protected all the time with all other pages unprotected.
 

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