Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Password Protected Word Templates

Status
Not open for further replies.

softwareguy

Programmer
Feb 21, 2002
14
US
Any ideas on how to create a new document based on a template with a modify password? I've tried both the Add and Open methods of the Documents collection without any luck. The user is always prompted for the password. Thanks.
 
Hi - I´ve just put the same question in Eng-Tips VBA Forum, and wonder if you (by yourself) have got a solution?
 
Have you tried the Protect Method? From VBA Help:

Protect Method


Protects the specified document from changes. When a document is protected, the user can make only limited changes, such as adding annotations, making revisions, or completing a form.

Note If the document is already protected when you use this method, an error occurs.

Syntax

expression.Protect(Type, NoReset, Password)

expression Required. An expression that returns a Document object.

Type Required Long. The protection type for the specified document. Can be one of the following WdProtectionType constants: wdAllowOnlyComments, wdAllowOnlyFormFields, wdAllowOnlyRevisions, or wdNoProtection.

NoReset Optional Variant. False to reset form fields to their default values. True to retain the current form field values if the specified document is protected. If Type isn't wdAllowOnlyFormFields, the NoReset argument is ignored.

Password Optional Variant. The password required to "unprotect" the specified document.

Since you say it's a template, you may have to protect the New TemplateDocument when it's created, but worth a shot! And I think you have to use the Add method with a template. I think by using Open it opens the actual template instead of creating a new document based on the template.
Leslie
landrews@metrocourt.state.nm.us

SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned
 
Hi Leslie,
in combination with the UnProtect method it works out fine. Thanks for the lead. Hope Softwareguy can use it too.
:-D regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top