Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Mac Mac is offline
external usenet poster
 
Posts: 16
Default Updating fields in Word

I am trying to save myself some typing in what I am doing but so far with
little luck. I'll try to explain this in something that looks like English.

I have a base document named Base.DOC. Periodically I need to import the
content of other documents into this documents. These imported documents have
reference fields included in them so that I only have to type something once
and the text is automagically inserted into other location in the document.
All well and good so far.

My problem arises when I need to insert the SAME document in the Base.DOC a
second time. When this happens all the reference information entered the
first time is entered into this new section.

Is there any way to create break or modify the reference so that when the
second or subsequent document is inserted the reference fields will refer to
the most recent entry and not simply the first entry?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Updating fields in Word

Reference (REF) fields reproduce the information stored in the bookmark they
refer to. It is not possible in the same document to have a REF field to
refer to two different pieces of information. Where is the bookmark
information coming from? Where is the second set of bookmark information
coming from?

Without seeing your document, you may be able to convert the first document
REF fields to text before importing the second copy of the document and then
update the bookmarked information. The original would then show the original
bookmarked information, the inserted document would show the new bookmarked
information. The following macro will fix all the REF fields in a document

Sub FixRefFields()
Dim oStory As Range
Dim oField As Field
For Each oStory In ActiveDocument.StoryRanges
For Each oField In oStory.Fields
If oField.Type = wdFieldRef Then
oField.Update
oField.Unlink
End If
Next oField
If oStory.StoryType wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
For Each oField In oStory.Fields
If oField.Type = wdFieldRef Then
oField.Update
oField.Unlink
End If
Next oField
Wend
End If
Next oStory
Set oStory = Nothing
End Sub

http://www.gmayor.com/installing_macro.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Mac wrote:
I am trying to save myself some typing in what I am doing but so far
with little luck. I'll try to explain this in something that looks
like English.

I have a base document named Base.DOC. Periodically I need to import
the content of other documents into this documents. These imported
documents have reference fields included in them so that I only have
to type something once and the text is automagically inserted into
other location in the document. All well and good so far.

My problem arises when I need to insert the SAME document in the
Base.DOC a second time. When this happens all the reference
information entered the first time is entered into this new section.

Is there any way to create break or modify the reference so that when
the second or subsequent document is inserted the reference fields
will refer to the most recent entry and not simply the first entry?



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2003 Updating Fields SuMi Microsoft Word Help 1 January 15th 09 10:57 PM
Fields updating inconsistently in Word 2003 Benjamin Chambers[_2_] Microsoft Word Help 3 March 4th 08 08:20 AM
Updating fields in Word 2007 JackRazz Microsoft Word Help 3 January 19th 08 02:19 AM
Using CTRL-A in Word 2007 but F9 is NOT updating fields? Bandicoot Microsoft Word Help 1 March 28th 07 12:36 AM
Automatically updating Fields in Word? JRae Microsoft Word Help 1 May 14th 05 03:02 AM


All times are GMT +1. The time now is 07:06 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"