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 / June 2005

Tip: Looking for answers? Try searching our database.

Protecting a word document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cunnus88 - 27 Jun 2005 07:24 GMT
I've created a word document which has been linked to its ow
independent template and all connections to normal.dot have bee
severed.

What I want to do is this. If a user opens this document and choose
not to include the macros, then the user shouldn't be able to see th
contents of the document or (even better) open it at all.

I tried doing some tricks with the Document_Open() procedure but to n
avail. It seems that this procedure is triggered after the user ha
chosen to include the macro.

I tried password protecting the document and then wondered whethe
there was a way to pass that password within Document_Open()  but i
seems the password request happens before that.

So is there any way to prevent a user from viewing the contents of
document at all if he chooses not to include the macros

--
cunnus8
Anne Troy - 27 Jun 2005 08:54 GMT
Not like we can do with Excel by hiding sheets that are unhidden when macros
are enabled. I think the best you could offer is a huge autotext entry that
gets used on the Document_Open would be about it... I'm anxious to see the
responses, too.
*******************
~Anne Troy

www.OfficeArticles.com
www.MyExpertsOnline.com

> I've created a word document which has been linked to its own
> independent template and all connections to normal.dot have been
[quoted text clipped - 14 lines]
> So is there any way to prevent a user from viewing the contents of a
> document at all if he chooses not to include the macros?

http://www.officehelp.in/index/index.php
Cindy M  -WordMVP- - 27 Jun 2005 13:37 GMT
Hi Cunnus88,

I agree with Anne on this one. If the macro isn't enabled, then there's
no way the macro can take any action. So the macro would have to be
responsible for creating the content, whether as AutoText, loading it
from another, password-protected file, or creating it from scratch.

> I've created a word document which has been linked to its own
> independent template and all connections to normal.dot have been
[quoted text clipped - 14 lines]
> So is there any way to prevent a user from viewing the contents of a
> document at all if he chooses not to include the macros?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)
Chuck - 27 Jun 2005 18:02 GMT
I've got my stupid goggles on today so I'm not quite visualising what you
mean by "if a users opens this document and chooses not to include the
macros", but leaving that aside it seems to me you can control whether the
document opens by opening it from an external macro called from a toolbar or
menu or userform or whatever.  Present the user with a "do you agree" type
message: if they say no, don't open, if they say yes, open. Your
toolbar/menu/userform can be in the independent template you mentioned the
document is linked to (for instance installing that template as an add-in).

HTH

> I've created a word document which has been linked to its own
> independent template and all connections to normal.dot have been
[quoted text clipped - 14 lines]
> So is there any way to prevent a user from viewing the contents of a
> document at all if he chooses not to include the macros?
Anne Troy - 27 Jun 2005 21:43 GMT
Ah... therein lies the problem, Chuck. The 2nd document still has to be
distributed (at least if you're outside a company network), and there's
virtually no way to protect the second document.
*******************
~Anne Troy

www.OfficeArticles.com
www.MyExpertsOnline.com

> I've got my stupid goggles on today so I'm not quite visualising what you
> mean by "if a users opens this document and chooses not to include the
[quoted text clipped - 25 lines]
> > So is there any way to prevent a user from viewing the contents of a
> > document at all if he chooses not to include the macros?

http://www.officehelp.in/index/index.php
Jezebel - 28 Jun 2005 01:44 GMT
I don't think there's any 'virtually' about it.... :)

> Ah... therein lies the problem, Chuck. The 2nd document still has to be
> distributed (at least if you're outside a company network), and there's
[quoted text clipped - 42 lines]
> http://www.officehelp.in/archive/index.php |
> http://www.officehelp.in/index/index.php
Klaus Linke - 28 Jun 2005 03:37 GMT
And if you'd distribute the document (password or even IRM protected) and a VB program that opens it with macros enabled?
You'd need to disassemble the VB program to get at the password.

The recipient would need to trust you blindly, though.

Greetings,
Klaus

>I don't think there's any 'virtually' about it.... :)
>
[quoted text clipped - 44 lines]
>> http://www.officehelp.in/archive/index.php |
>> http://www.officehelp.in/index/index.php
Helmut Weber - 28 Jun 2005 03:48 GMT
Hi Klaus,
...
at this early hour,
...
got a new newsreader?

In Agent forte there are no automatic linebreaks anymore
in your postings. Makes them very hard to read.

Greetings from Bavaria, Germany

Helmut Weber, MVP, WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
Chuck - 28 Jun 2005 11:18 GMT
Ok, so the problem is with distributing the *template* that the document is
based on? If by "linked" the OP meant that the document itself contains
macros that reference the separate template, the OP could instead move the
macros to the template and call them from there.

Sorry for being dim but I don't understand what the real world problem is.  
If the point is to distribute a document that is "linked" (based on?) a
separate template to users who may not be able to or choose not to run macros
from untrusted sources then it seems to me the solution would be to:

1. make sure the document contains no code and is password protected.
2. protect the code in the template so that it can't be viewed/edited
3. include a macro in the template that opens the document with a hard coded
password - the password is hidden by the protection on the code
4. if the user chooses not to enable macros, they can't open the document
because they don't have the password
5. if the user enables macros and opens the document, the password is
removed via the code so there's no protection issue on the document anymore
but the code is still protected so the password is as well

That solution separates the contents of the document from the template so
that even if the user opens the template with macros disabled they can't see
the contents the OP wants to hide.

Unless the OP password protects the document, users can still view the
contents with any number of viewers.  Granted, password protection is fairly
easily cracked so the above workaround isn't bulletproof but hopefully it
would get the job done?

Then again, maybe I've still got stupid goggles on.

> Ah... therein lies the problem, Chuck. The 2nd document still has to be
> distributed (at least if you're outside a company network), and there's
[quoted text clipped - 39 lines]
> http://www.officehelp.in/archive/index.php |
> http://www.officehelp.in/index/index.php
Charles Kenyon - 28 Jun 2005 15:22 GMT
Yes, sort of. You need to put the contents of the word document in a place
that is only accessible to macros. You could
Have your AutoOpen (or AutoNew) macro create your document. If macros don't
run, there is nothing there to look at. Of course once it has been created /
opened with macros open, nothing prevents it being saved and reopened.
Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> I've created a word document which has been linked to its own
> independent template and all connections to normal.dot have been
[quoted text clipped - 14 lines]
> So is there any way to prevent a user from viewing the contents of a
> document at all if he chooses not to include the macros?
cunnus88 - 29 Jun 2005 11:07 GMT
So, it's been solved (in a way)

--
cunnus8
 
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.