Replace Form Field w/Auto Text

D

Dax Arroway

Is there a way to use Find and Replace to replace a blank text form field
with an autotext entry?

I've got a locked for which I'm adding a spellcheck macro to, which unlocks
the form and then spellchecks it before re-locking it. As it says in the
description, one of the issues is that when the form is unlocked, spellcheck
will spellcheck the entire document, not only the form fields themselves.
The article goes on to explain that a fix, is to nest the form fields into
individual tables. OK, fine, easy enough. Problem is my form is all ready
created so I have a .dot purliforated with form fields that not need to be
replaced with form fields nested within tables. To make it easier and
automate the process I'm thinking that I could use an autotext entry but I
don't know how to put the text form field in the Find box and the autotext
entry in the Replace box.

Anyone got an article or an explaination of how to do that if it's possible?
Either that or is there a way of coding the spellcheck macro to only look at
form fields? (Maybe that should have been my first question). Either answer
would get me to where I want to go.

Thanks in advance!
Dax
 
G

Graham Mayor

If you don't want to check the whole form apply the language proofing
parameter setting 'do not check spelling' to the parts you don't want to
spell check.

If the form is unlocked, you can search for

^d FORMTEXT

which will find form fields a within a document. If you insert the autotext
in a document and copy it to the clipboard, you can replace with the
clipboard contents ^c

If you want to replace a particular form field with a particular autotext
entry then you need a macro The following assumes that you want to replace a
form field called Text2 with an autotext entry called AutotextName. Note the
different methods required for Word 2003 and 2007

Dim bProtected As Boolean
'Unprotect the file
If ActiveDocument.ProtectionType <> wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect Password:=""
End If
ActiveDocument.FormFields("Text2").Select
'NormalTemplate.AutoTextEntries("AutotextName").Insert
Where:=Selection.Range, _
RichText:=True 'Word 2003
NormalTemplate.BuildingBlockEntries("AutoTextName").Insert Where:=Selection.
_
Range, RichText:=True 'Word 2007
If bProtected = True Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
End If


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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