Autonew and Ask fields

A

Andy

I have a template with an ASK field and an IF field
included inside the ASK field. It is similar to the
examples in KB211664. I included an Autonew macro to
automatically update the fields when I create a new
document based on the template (I used the language in
KB212703). When I create a new document, the prompt in
the ASK field (with the included IF field) appears two or
three times in succession before moving to the next ASK
field. Why does this happen and is there a workaround?

Thanks.
Andy
 
C

Cindy Meister -WordMVP-

Hi Andy,

This is happening because of the way Word updates fields.
The updating IF field will force the ASK field to update.
Can you explain how you're using an IF field in the ASK
field? There might be a different approach...
I have a template with an ASK field and an IF field
included inside the ASK field. It is similar to the
examples in KB211664. I included an Autonew macro to
automatically update the fields when I create a new
document based on the template (I used the language in
KB212703). When I create a new document, the prompt in
the ASK field (with the included IF field) appears two or
three times in succession before moving to the next ASK
field. Why does this happen and is there a workaround?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan
24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
A

Andy

-----Original Message-----
Hi Andy,

This is happening because of the way Word updates fields.
The updating IF field will force the ASK field to update.
Can you explain how you're using an IF field in the ASK
field? There might be a different approach...


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan
24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e- mail
:)

.
Cindy:

Thanks for your response. I have found a partial
workaround the AutoNew macro problem and perhaps you can
give me guidance on finishing the solution. Rather than
using the macro language in KB212703, I recorded an
AutoNew macro which updates the fields without any
problems but, unfortunately, does not update the headers
and footers. The macro language in KB212703 reads:

Sub AutoNew()
Dim aStory As Range
Dim aField As Field
For Each aStory In ActiveDocument.StoryRanges
For Each aField In aStory.Fields
aField.Update
Next aField
Next aStory
End Sub

The macro I recorded reads:

Sub AutoNew()
Selection.WholeStory
Selection.Fields.Update
End Sub

The only problem with my recorded macro is that it does
not update the fields in headers and footers. Can you
direct me to a source for adding a subroutine to update
the headers and footers? Unfortunately I am not a macro
expert.

Thank you for your response.

Andy
 
D

Doug Robbins - Word MVP

Hi Andy

To get the fields in the headers and footers to update use

Dim i As Integer

For i = 1 To ActiveDocument.Sections.Count
With ActiveDocument.Sections(i)
.Headers(wdHeaderFooterFirstPage).Range.Fields.Update
.Headers(wdHeaderFooterPrimary).Range.Fields.Update
.Footers(wdHeaderFooterFirstPage).Range.Fields.Update
.Footers(wdHeaderFooterPrimary).Range.Fields.Update
End With
Next i

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

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