Linking to a Field

S

SV

Greetings,
I've inherited a Word document in which a figure is shown on one page, and a
list of the parts that make it up is shown on the page.
The figure caption uses the SEQ field command:

SEQ Figure_6- \* ARABIC

And so each figure in this section shows up as 6-1, 6-2, etc. No problems
so far.
The parts list on the next page refers to the figure, so the parts list for
figure 6-2 would have, before each item, "6-2" Still no problems.

We had to add a figure in the early parts of the book and, since the figures
were all identified using the SEQ field command, they all updated without
problem.

The parts lists, however, had their figure numbers in as text, not a field,
so I'm looking at having to go down 70 pages of parts lists and updating
each line number with a new figure number. I can do a "Highlight the page,
do find/replace" 70 times but aside from being darned tedious, it'll have to
be repeated if we end up adding another figure.

I tried inserting a cross-reference, but none of them gave the option of
cross-referencing to the field in the figure.

Given the SEQ field command on each figure, is there a way I can link the
parts lists to that field so that when the figure number changes, the parts
list is updated with it? Is there a field for numbering I can add to the
figure (in the way of white, therefore invisible, text) that WILL take a
cross-reference?

I'm using Word 2003 sp2 in XP.

Thanks,
Shane
 
D

Doug Robbins - Word MVP

If you part numbers are of the form

6-2-1

6-2-2

6-2-3



The following macro would increment the digit between the - - by 1 (each
time it is run)



Dim srange As Range
Dim i As Long, j As Long
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="6-[0-9]{1,}-[0-9]{1,}",
MatchWildcards:=True, _
MatchCase:=False, Wrap:=wdFindStop, Forward:=True) = True
Set srange = Selection.Range.Duplicate
Selection.Collapse wdCollapseEnd
Selection.MoveRight wdCharacter, 1
With srange
i = InStr(.Text, "-")
j = InStrRev(.Text, "-")
.Text = Left(.Text, i) & Mid(.Text, i + 1, j - i - 1) + 1 &
Mid(.Text, j)
End With
Loop
End With


Save a copy of the document before running it.
--
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
 
S

SV

Doug,
I'm not sure if I've been clear. I'll try an example:

I have 20 parts, each of which is shown on figure 6-3 and 40 parts, each of
which is shown on figure 6-4.
The parts list for figure 6-3 shows, in the first column, nothing but 6-3's
and the parts list for 6-4 shows nothing but 6-4's.
This is as it should be.

Now, I insert a figure between them, which is automatically numbered as 6-4
(because of the SEQ command), and 6-4's figure number automatically updates
to 6-5.
Unfortunately, the parts list for the old 6-4 (now 6-5) still shows all
"6-4" as they're all TEXT not fields or anything.
I'm looking for a way to have the figure number identifiers on the parts
list follow the number of the figure if it changes.

Shane

Doug Robbins - Word MVP said:
If you part numbers are of the form

6-2-1

6-2-2

6-2-3



The following macro would increment the digit between the - - by 1 (each
time it is run)



Dim srange As Range
Dim i As Long, j As Long
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="6-[0-9]{1,}-[0-9]{1,}",
MatchWildcards:=True, _
MatchCase:=False, Wrap:=wdFindStop, Forward:=True) = True
Set srange = Selection.Range.Duplicate
Selection.Collapse wdCollapseEnd
Selection.MoveRight wdCharacter, 1
With srange
i = InStr(.Text, "-")
j = InStrRev(.Text, "-")
.Text = Left(.Text, i) & Mid(.Text, i + 1, j - i - 1) + 1 &
Mid(.Text, j)
End With
Loop
End With


Save a copy of the document before running it.
--
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

SV said:
Greetings,
I've inherited a Word document in which a figure is shown on one page,
and a list of the parts that make it up is shown on the page.
The figure caption uses the SEQ field command:

SEQ Figure_6- \* ARABIC

And so each figure in this section shows up as 6-1, 6-2, etc. No
problems so far.
The parts list on the next page refers to the figure, so the parts list
for figure 6-2 would have, before each item, "6-2" Still no problems.

We had to add a figure in the early parts of the book and, since the
figures were all identified using the SEQ field command, they all updated
without problem.

The parts lists, however, had their figure numbers in as text, not a
field, so I'm looking at having to go down 70 pages of parts lists and
updating each line number with a new figure number. I can do a "Highlight
the page, do find/replace" 70 times but aside from being darned tedious,
it'll have to be repeated if we end up adding another figure.

I tried inserting a cross-reference, but none of them gave the option of
cross-referencing to the field in the figure.

Given the SEQ field command on each figure, is there a way I can link the
parts lists to that field so that when the figure number changes, the
parts list is updated with it? Is there a field for numbering I can add
to the figure (in the way of white, therefore invisible, text) that WILL
take a cross-reference?

I'm using Word 2003 sp2 in XP.

Thanks,
Shane
 
C

Cindy M.

Hi Sv,
I have 20 parts, each of which is shown on figure 6-3 and 40 parts, each of
which is shown on figure 6-4.
The parts list for figure 6-3 shows, in the first column, nothing but 6-3's
and the parts list for 6-4 shows nothing but 6-4's.
This is as it should be.

Now, I insert a figure between them, which is automatically numbered as 6-4
(because of the SEQ command), and 6-4's figure number automatically updates
to 6-5.
Unfortunately, the parts list for the old 6-4 (now 6-5) still shows all
"6-4" as they're all TEXT not fields or anything.
I'm looking for a way to have the figure number identifiers on the parts
list follow the number of the figure if it changes.
You can bookmark the entire figure number, then use a REF field instead of the
static "6-n" numbering for each part. For example, you can select the 6-4 text
then Insert/Bookmark. Type a descriptive name (Part_test, for example). Now
delete the 6-4 in front of a part designation, press Ctrl+F9 to insert field
brackets and type REF Part_test. Shift+F9 will hide the field code. From here
on, you can copy the field and paste it over the other numbers.

If you insert another set in front of the 6-4 information, once all the fields
in the document are updated (Ctrl+A, F9 will force this), all the Ref
Part_test fields will display 6-5, same as the Figure caption.

Another way to do this would be to use Insert/References/Cross reference but I
find that slower and less easy to maintain (the bookmark names are many-digit
numbers) than the "manual approach".

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

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

SV

Cindy,
Ah, I figured there had to be a way, thanks! Now to update the rest of the
document and use it in future documents!

Thanks,
Shane
 

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