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

Word 2003 Forms Fields & Macro Question 2

Status
Not open for further replies.

pozitron969

Programmer
May 14, 2002
29
0
0
US
Hello all,

I am creating a form to document the autmoated processes we do at work. I have created a doc that has a series of nested tables. The File information section contains a text form field and four check box fields, for filename, Read, Write, Update and Delete information. I have placed a macro button that will insert a new line in the table and create the appropriate text and checkbox fields.

So here is the problem I am having. When I trigger the macro it unprotects the document inorder to add the table row and create the fields. When this happens any information already entered into the other fields gets destroyed. I am thinking this is due to unprotecting the document and then protecting it from inside the macro. Is there a way to preserve the information between the unprotect and protect actions? This may happen twenty to thirty times during the life of the form. The row creation needs to be dynamic.

Thank you for your help.
 
Hi pozitron969,

Use NoReset ...
Code:
[blue]ActiveDocument.Unprotect Pasword:=[i]YourPassword[/i]
[green]:
:
:[/green]
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, [red]NoReset:=True[/red], Password:=[i]YourPassword[/i]
[/blue]

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Thank you very much. That did it! Hope you have a great day.

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top