Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2006

Tip: Looking for answers? Try searching our database.

Unprotecting and Protecting Document via mouse click on active pag

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brendan - 10 Aug 2006 22:10 GMT
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?
Jezebel - 10 Aug 2006 22:35 GMT
Put a section break between pages one and two, and protect only section one.

> 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
[quoted text clipped - 21 lines]
> I
> making this too complicated?
Brendan - 10 Aug 2006 23:01 GMT
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:=""

> Put a section break between pages one and two, and protect only section one.
>
[quoted text clipped - 23 lines]
> > I
> > making this too complicated?
Jezebel - 10 Aug 2006 23:36 GMT
>I know the below code works for the entire document but what would the code
> be for just the section?
[quoted text clipped - 39 lines]
>> > I
>> > making this too complicated?
Jezebel - 10 Aug 2006 23:37 GMT
activedocument.sections(1).Protectedforforms = true

>I know the below code works for the entire document but what would the code
> be for just the section?
[quoted text clipped - 39 lines]
>> > I
>> > making this too complicated?
Brendan - 16 Aug 2006 17:29 GMT
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.

> activedocument.sections(1).Protectedforforms = true
>
[quoted text clipped - 41 lines]
> >> > I
> >> > making this too complicated?
Jean-Guy Marcil - 11 Aug 2006 15:06 GMT
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?
[quoted text clipped - 3 lines]
>      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.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.