locked
Table loses reference after adding another table with reference using building blocks RRS feed

  • Question

  • Hi all

    I've created a table with a cross reference and I added this table in the building blocks/quick parts.

    The problem is when I add a new table through the building blocks(with caption referencing the table), all the caption starts pointing to the last table.

    For example. How it supposed to be:

    Caption Table 1
    TABLE 1

    Caption Table 2
    TABLE 2

    Caption Table 3
    TABLE 3

    What is happening after I update the fields:

    Caption Table 3
    TABLE 1

    Caption Table 3
    TABLE 2

    Caption Table 3
    TABLE 3

    I'm not sure if anyone have ever had the same problem like this one.

    Thanks in advance!



    • Edited by macshihiro Thursday, February 27, 2020 1:24 AM
    Thursday, February 27, 2020 1:12 AM

All replies

  • Thursday, February 27, 2020 7:31 AM
  • Hi,

    What version of Office are you using now?

    Could you please tell us more about your problem? Where do you insert the "new table" from Quick Parts in your document? I make a sample according to your description and press F9 or right-click and select Update Field, but I could not reproduce the problem. 

    The following gif shows the object referenced after I update field. The last table is added from QuicK Parts.

    If I have any misunderstanding, please feel free to post back.

    Best Regards,

    Emily


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Office 2019.


    Thursday, February 27, 2020 10:07 AM
  • Can you save a sample document with the problem (and with confidential proprietary material removed) to DropBox or OneDrive and post a view link here?

    Charles Kenyon Madison, WI

    Friday, February 28, 2020 3:28 PM
  • Hi Charles

    Follow the example below:

    https://www.dropbox.com/s/wcd48k0kdcodm9k/example.dotm?dl=0

    I added a table with label in the quick parts.

    when I add 1 or more table using the building blocks and update the fields. Almost all of them points to the last table.

    ----------------------------------------------------------------------

    Hi Emily

    Thank you for your reply.

    My Office is 365 MSO(16.0.12430.20198) 64bits

    I have created an example file and placed it on Dropbox, follow the link below:

    https://www.dropbox.com/s/wcd48k0kdcodm9k/example.dotm?dl=0

    ----------------------------------------------------------------------

    Hi macropod

    I'm sorry for the duplicated question. Can you tell me how to delete the other post?


    • Edited by macshihiro Monday, March 2, 2020 5:19 AM
    Monday, March 2, 2020 4:37 AM
  • The problem is that

     a. when you insert a cross-reference in Word, Word creates an invisible bookmark that "covers" the text that you want to reference, then specifies that bookmark name in the field it inserts

     b. so in this case Word has created a bookmark called  _Ref21607890 (the "_" at the beginning means that the bookmark is "invisible""and not listed in some places in Word), and a REF field to reference it like this: { REF _Ref21607890 \h }

     c. In a Word document, there can only be *one* bookmark with a given name. In this case, when you insert another copy of the building block, Word will delete the existing bookmark called 
    "_Ref21607890" and retain the one you just inserted.

     d. So when you update those REF fields, they will all point to the same location in the document (not necessarily the last table in the document - if you insert your building block at the beginning of the document, they will all end up pointing to the first table).

    There are a couple of ways you could try to deal with this, but in my view the simplest one is not to try to store the { REF } field as part of the building block, and to accept that you will then have to create the necessary cross-reference REF fields in the usual way, e.g. using the Insert Cross-Reference dialog.

    The other way would be to write a bit of VBA that inserted the block, created the appropriate bookmark itself, then modified the bookmark name in the REF field to match that, and provide the user with a keystroke or ribbon option to insert the block using that.

    It's tempting to imagine that you could write some clever field codes  that would generate a unique bookmark for you each time you inserted the block, but even if you could, putting additional field codes in a Word caption typically undermines Word's ability to work with Captions in the usual way. Nor do I think it would actually make things any easier for the user.


    Peter Jamieson

    Monday, March 2, 2020 9:21 AM
  • Hi macshihiro,

    Please check whether Peter's reply is helpful, thanks Peter for such a detailed explanation.

    If you have any updates, please feel free to let us know.

    Best Regards,

    Emily


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Office 2019.

    Thursday, March 5, 2020 10:10 AM