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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with open a protected word document

Status
Not open for further replies.

theismanapp

Programmer
Jul 27, 2005
5
US
I have Access 2002 and Word 2002 on my computer. The word file is a template. The template includes text and some bookmarks. I need to password protect the document so that the users can oly enter data in specific areas of the form. I program access to open the template and fill in the data with specific information. When I click on the button to open word I get an error message saying

Run-time error '4605'

This method or property is not available because the object refers to a protected area of this document.

When I open the template up manually I can enter data.
Here is teh code I am using

.Documents.Open "C:\Documents and Settings\scotts\Desktop\ABBREVIATED_REPORT.dot", , , , , "test", , , "test"

What do I need to do to get it to work, The code works with the file being password protected

Thanks in advance
 
Whenever I want to automate anything in Word (not very often) and I don't know how to do it, I record a macro (vba same thing as a module in Access) in word performing the action and then I look at the recorded macro and see how it works. This works most of the time.

I hope this works for you.
 
Doing the Macro did not work.

Thanks for the suggestion
 
Recording in Word 2003 is one line of code.

ActiveDocument.Unprotect

The help says that the unprotect method takes password as an optional parameter.

I hope it is the same for your version.

 
In Word 2002 the code is the same. The problem now is that when the form is unprotected and the data is inserted in the appropiate fields and the word document is protected again all of the bookmarks or fields are deleted so only thing I see is the data. I would like to be able to have a user able to edit the data if need and to be able to reference the fields in a header. I am think that word locks the entire section from VBA code and only allows a user to type in the fields.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top