Automatic protect/unprotect document

S

Susan J-P

Although I'm an experienced Word user, I'm a neophyte with VBA. I've found
some posts that discuss the issue I'm trying to resolve, but nothing quite
fits my situation.

Here's the situation:

We have a shared Word template with form fields on the title page (section
1) that are used to populate the headers/footers of the document (e.g.
document title, version, date, author, etc.). I'd like to protect the form
fields as the various authors more often than not simply delete the field
when adding the appropriate information to the title page. I've already
figured out how to make this a protected section.

The rest of the document should remain unprotected but needs to have the
full gamut of Word editing features available (comments, track changes,
graphics, etc.). As long as the document is protected, these features are
unavailable.

So I'm trying to figure out if it's possible to have the document
automatically unprotect itself whenever the user is anywhere other than
section 1; and to protect section 1 whenever the user is in section 1. So the
logic is something like:

if current section = 1
then protect
else
unprotect

I've been stumbling around for a couple of days with VBA trying to figure
out if this is really do-able but haven't had much luck. I figure the more
experienced of you out there can at least point me in the right direction
here.

Of course, if there's a better solution to this, I'd pleased to learn more.
Just keep in mind that I'm trying to keep the solution simple both for the
users and for me!

Thanks for any help you can provide.

Susan
 
G

Gordon Bentley-Mix on news.microsoft.com

Susan,

I think the only way to accomplish this is to write code against the
WindowSelectionChange event, and this might be beyond the capabilities of a
VBA neophyte. (In fact, it would probably be beyond my capabilities without a
lot of effort and learning. <g>) However, if you're really keen, start by
looking at the VBA Help topic on the WindowSelectionChange event.

Just be aware that the code you write against this event will run *every
time* the selection changes, which could create quite a lot of overhead and
produce unacceptable delays in the responsiveness of Word. In addition, there
might be some limitations to this event (e.g. it doesn't fire if the
selection is changed by clicking the mouse on a different spot in the
document or something), so it may not be all that reliable.
--
Cheers!

Gordon Bentley-Mix
Word MVP

Please post all follow-ups to the newsgroup.

Read the original version of this post in the Office Discussion Groups - no
membership required!
 
D

Doug Robbins - Word MVP

S

Susan J-P

Gordon, thanks for the response. I was afraid that my goal would be
complicated to implement with VBA. And I don't know if I'm up to the task, or
if the effort required would be worth the payoff.

Doug, I will look into the UserForm option, which also looks on the
complicated side, particularly since the UserForm will need to be reusable
(the version number and date, for instance, will need to change from time to
time) and will need to initiate per the user's need (rather than on AutoNew
or AutoOpen for instance). I'll be back if I run into snags with this.

Susan
 

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