AutoNew with fld.Unlink not working in docs created from template

N

NewbiePete

Hi

I'm using 2003/XP and have recreated a basic Word 2000 template by
copy & pasting into my 2003 blank doc (without the last paragraph
mark) and have inserted fields like this:
{ FILLIN "ENTER TECHNICAL REPORT TITLE" \d "ENTER TECHNICAL REPORT
TITLE" } and have created an AutoNew vba in the template as below:

' AutoNew Macro
'updates the FILLIN & ASK fields and displays the appropriate prompts
when
'a user creates a new document based on your template, and then
unlinks them
'so the prompts don't keep reappearing.

Sub AutoNew() 'from http://word.mvps.org/FAQs/Customization/FillinTheBlanks.htm
Dim Fld As Field

ActiveDocument.Fields.Update
For Each Fld In ActiveDocument.Fields
If Fld.Type = wdFieldAsk Or Fld.Type = wdFieldFillIn Then
Fld.Unlink
End If
Next Fld
Selection.GoTo What:=wdGoToBookmark, Name:="Exec_Summary"
End Sub

however when I create a .doc from the template the FILLIN are
repeating, there are currently no ASK. It does jump to the Exec
Summary section when I cancel out of the FILLINS.

Do I need a Do Until?

Also tried

Sub AutoNew()
Selection.WholeStory
Selection.Fields.Update
Selection.GoTo What:=wdGoToBookmark, Name:="Exec_Summary"
End Sub

with the same result.

Thanks again for all the great advice I've received.

Peta
 

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