cross-referencing in callouts

J

Jose Durazo

Greetings! Has anyone here found a way to get cross-references in call-outs
to update when all document cross-references are updated?

Here's an example of my problem: I frequently use Word call-outs on pictures
in my documents to further explain things. I also started referencing other
sections with further details from within the callouts. This seemed very
useful until I found out that when I select my whole document, using for
example Ctrl+A, and then press the F9 key to update my cross-references, the
references in callouts are not updated.

The only way I know of to make these references update is to click in each
individual callout, select its text, and press the F9 key. With dozens of
callouts in my documents this is very inconvenient.

Any suggestions from the experts?

Thanks,
Jose
 
D

Doug Robbins - Word MVP

Running a macro containing the following code should probably do what you
want:

Dim myStoryRange As Range

For Each myStoryRange In ActiveDocument.StoryRanges
myStoryRange.Fields.Update
Do While Not (myStoryRange.NextStoryRange Is Nothing)
Set myStoryRange = myStoryRange.NextStoryRange
myStoryRange.Fields.Update
Loop
Next myStoryRange


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

Jezebel

You can make this a little more efficient (although hardly significant
speed-wise) --


Dim myStoryRange As Range

For Each myStoryRange In ActiveDocument.StoryRanges
Do
myStoryRange.Fields.Update
Set myStoryRange = myStoryRange.NextStoryRange
Loop until myStoryRange Is Nothing
Next
 
J

Jose Durazo

Doug, this suggestion worked. Many thanks!
I changed the code a bit to the following because I believe your original
code would have updated the same "story" multiple times. Did I
misunderstand something?

My changed code:

For Each myStoryRange In ActiveDocument.StoryRanges
myStoryRange.Fields.Update
Next myStoryRange
 
J

Jezebel

A document consists of a number of types of StoryRange. The For ... each
loop gets the first instance of each *type* of StoryRange, that actually
occurs in the document. In some cases -- as with the MainStory -- there can
be only one range of that type. However with some types -- eg headers and
footers where your document has multiple sections with separately defined
headers, textboxes, etc -- there may be any number of StoryRanges of that
type. Hence the need for the inner Do ... Loop.

In effect the StoryRanges are set up as a set of linked lists: the For ...
Next loop gets the first item in each list. The .NextStoryRange property
points to the next item in that list if there is one.
 
J

Jose Durazo

Thanks Jezebel. This has helped me understand why my code won't work far
beyond my simple test case which never went beyond the first range in a top
level range and how to fix the problem correctly.

Jose
 

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