Prevent Changes to Header

S

scorpion53061

I have developed code which I use in constructing a word document that I
would like to be able to prevent changes to the header.

The only requirements put on me is that the document has to be able to be
opened in MS Word 2000 or above.

(Their license to use the software includes the users name and that is
printed in the page header. Their line of thinking is that they won't use
the document (the software which creates the document) if it has someone
elses name in the document.)

My guess is this is not possible. But I thought I would ask.
 
J

Jezebel

You don't need to get it into the document; only into the template. However
they've left a bit out (they can't have tested it, in fact). This code won't
work in an ordinary code module: declarations 'withevents' work only in
object modules (classes or forms). To make it work you need to create a
class module containing the selectionchange event, then create an ordinary
module that, on start-up, instantiates an instance of your class module...
are you sure you want to do all this?

The trouble with this sort of technique is that it's unnecessary for
well-behaved users (they won't do it anyway), and insufficient for
ill-intentioned users (it's *very* easily defeated), eg --

Method 1:
1) Create or open a document based on your template.
2) Switch to VBA
3) Make any change to any code in any module (amongst other things) -- this
stops the VBA project and kills the wdApp reference.

Method 2:
Run a spell check in Normal mode. If there is anything in any header or
footer that troubles the spell-checker it will get selected. But because
you're not in Print view, the 'SeekView' instruction will fail, leaving the
user in the header/footer with the code no longer running.

Method 3:
Make the change using Range objects rather than the selection object. The
macro won't see it at all.
 
S

scorpion53061

The document itself is in a vb.net applicaiton which is providing other
services such as automating other tasks that they will need.
If I can somehow adapt the code so that if they click on the header while
inside the application...

Of course, after they close the app they could open it in word and change
the header unless I can stick that code into the document itself (record a
macro on the fly? - I am not sure that can be done) that prevents header
changes in the document...) but you may be right I may looking at the wrong
way of doing this.
 
J

Jonathan West

Hi Scorpion,

Word isn't designed to be able to do wat you are wanting with complete
security.

A better (though not absolutely secure) alternative, would be to convert the
document to PDF format using Adobe Acrobat, and then apply security settings
available in Acrobat to that document.
 
S

scorpion53061

Hi Johnathen,

Automation with PDF I have never been able to do.

But to be truthful it does not have to be completely secure. Just enough to
get my boss off my back :)
 
J

JGM

Hi Scorpion

and
method 4) Save asRTF....
method 5) CTRL-A > New Doc > CTRL-V
method 6) Save your doc > New doc > Insert > File...
Then
save as .doc, do whatever with header, attach back to original template and
save again ....

Or am I way off tracks?

Cheers!
 
S

scorpion53061

Forgive me JGM for my ignorance.......

Could you demonstrate in code what you are doing here.
 
J

Jonathan West

He's just demonstrating other ways in which the security could be broken by
various ways of copying the content to another document.
 
W

Word Heretic

G'day "scorpion53061" <[email protected]>,

Section break the thing and protect it against change with a password

Tools > Protect Document...

I have developed code which I use in constructing a word document that I
would like to be able to prevent changes to the header.

The only requirements put on me is that the document has to be able to be
opened in MS Word 2000 or above.

(Their license to use the software includes the users name and that is
printed in the page header. Their line of thinking is that they won't use
the document (the software which creates the document) if it has someone
elses name in the document.)

My guess is this is not possible. But I thought I would ask.

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If my answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.
 
S

scorpion53061

I will be in touch....nice site.

Word Heretic said:
G'day "scorpion53061" <[email protected]>,

Section break the thing and protect it against change with a password

Tools > Protect Document...



Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If my answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.
 
S

scorpion53061

What date do you anticipate your release on

"Work In Progress on advanced Word usage".
 
W

Word Heretic

G'day "scorpion53061" <[email protected]>,

it's avail for sale now as it has loads of good info. I dont expect it
to be finished for another year or so.

I am more concerned with finishing my toolsets at the moment I guess.


What date do you anticipate your release on

"Work In Progress on advanced Word usage".

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If my answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.
 
S

scorpion53061

vba code and examples yes?

Word Heretic said:
G'day "scorpion53061" <[email protected]>,

it's avail for sale now as it has loads of good info. I dont expect it
to be finished for another year or so.

I am more concerned with finishing my toolsets at the moment I guess.




Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If my answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.
 
W

Word Heretic

G'day "scorpion53061" <[email protected]>,

The VBA (more so) and the Beginner's - yes. The Word one, most def
not where possible - wrong audience ;-)


vba code and examples yes?

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If my answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.
 

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