Using fields, having text disappear when unprotecting/protecting d

G

Guest

We are using Word 2000 at work, and I have created a number of forms that
contain fields. Sometimes, the text outside the fields needs to be changed,
so the document is unprotected and then protected. At that point, any text
in the fields disappears and has to be re-entered. How can we prevent this?
 
M

macropod

Hi Dave,

You can preserve the formfield contents via a macro:

Sub Reprotect()
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:="myPassword"
End Sub

To add the macro to your document, press Alt-F11 to open the VBE, then use Insert|Module to add a code module, and paste the code
into your document. Insert the form's password between the quotes in "myPassword".

To run the macro from within the VBE, press F5.

Press Alt-F11 again to return to the document.

To run the macro from within the document, press Alt-F8, then double-click on 'Reprotect'.

If you don't want the macro and its module to remain with the document, use File|RemoveModule.

Cheers

--
macropod
[MVP - Microsoft Word]


| We are using Word 2000 at work, and I have created a number of forms that
| contain fields. Sometimes, the text outside the fields needs to be changed,
| so the document is unprotected and then protected. At that point, any text
| in the fields disappears and has to be re-entered. How can we prevent this?
 

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