Auto update field issue

A

Ana

I am working with Word 2003. I have to create a large document by
pulling in various files (each file is from 1-15 pages long). Each file
becomes a section in the document. Each section has a footer that
consists of fields from original files. After the document is created I
have to print it, but I don't want to update fields - I want to keep
the original values. Option Update fields is turned off (Tools,
Options, Print tab), but Word still updates them when I try to print
it. I also tried selecting whole document (CTRL + A), and then pressing
CTRL+SHIFT+F9 to convert fields to regular text, and it worked for text
in the document, but not footers. I can select text in footer of every
section and then change fields into text, but is time consuming. Is
there any way to select ALL text (including footers in all sections) in
one or two steps?

Thanks!
 
C

Charles Kenyon

What follows is a macro that locks merge fields. If you get rid of the test
If oField.Type = wdFieldMergeField Then
oField.Lock
End If

and substitute
oField.Lock

it should work. Haven't tested though.

oStory.Fields.Lock
might lock all fields in the story. I expect it would, but haven't tested.

Sub MergeFieldLockAllStory()
' Written by Charles Kyle Kenyon 1 April 2005
'
' All Story Field Locker - Merge fields
Dim oField As Field
Dim oStory As Range
' On Error Resume Next
For Each oStory In ActiveDocument.StoryRanges
' This goes into headers and footers as well as the regular document
Do
For Each oField In oStory.Fields
If oField.Type = wdFieldMergeField Then
oField.Lock
End If
Next oField
Set oStory = oStory.NextStoryRange
Loop Until oStory Is Nothing
Next oStory
End Sub

Hope this helps,
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
J

Jezebel

I don't know of an automatic way to do this, but the following code will do
it --

Sub Macro1()

Dim pRange as Word.Range

For each pRange in ActiveDocument.Storyranges
Do
pRange.Fields.Unlink
set pRange = pRange.NextStoryrange
Loop until pRange is nothing
Next

Msgbox "Finished"

End Sub
 
A

Ana

Thank you all so very much for your help!! The code really works, but
unfortunately Word updates fields before the code unlinks them. But you
gave me a great start because I have almost no experience with VBA. So,
I'm now playing with the code, and I'm sure I'll find solution to my
problem.

Thanks again!!!!
 
C

Charles Kenyon

For the includetext fields, take another look at the switch referred to
earlier.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

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