Results 1 to 9 of 9
  1. #1
    5 Star Lounger Vincenzo's Avatar
    Join Date
    Mar 2004
    Posts
    654
    Thanks
    95
    Thanked 14 Times in 13 Posts
    I am using Word 2003 and I would like to set up a document in which a number will be entered in a cell in a table, and then I need that number to be repeated elsewhere in the text part of the document. I assume this is done with fields but can't figure it out.

    Thanks

  2. #2
    4 Star Lounger
    Join Date
    Jan 2010
    Location
    Chichester, UK
    Posts
    401
    Thanks
    1
    Thanked 10 Times in 9 Posts
    See this guide on Repeating Text at http://gregmaxey.mvps.org/Repeating_Data.htm

    Terry

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    Quote Originally Posted by Vincenzo View Post
    I am using Word 2003 and I would like to set up a document in which a number will be entered in a cell in a table, and then I need that number to be repeated elsewhere in the text part of the document. I assume this is done with fields but can't figure it out.
    The usual method is to assign a bookmark to the text you want to copy, and then use a REF field to copy the text from that bookmark to another area. I'm not sure how well that will work inside a table cell. The user may inadvertently delete the bookmark when tabbing or clicking into the cell.

    An alternative method is to define a unique style name for the cell (new paragraph style), and then use a STYLEREF field to copy the text from that styled paragraph. Because STYLEREF generally copies the last paragraph with that style (the first one found when searching upwards), if the user adds a row and copies that style to a new cell, this could cause a problem, but that might not be an issue for your document.

  4. #4
    5 Star Lounger Vincenzo's Avatar
    Join Date
    Mar 2004
    Posts
    654
    Thanks
    95
    Thanked 14 Times in 13 Posts
    Thanks for the link to the Repeating Text page, but from what I see by experimenting with that feature, it is not really a good solution here.
    Once I click Protect Form, then you are really limited in what you can edit on the document.
    And I can't expect the person who is using this document to understand how to use the Forms Toolbar to protect/unprotect the doc as needed.

    I see that STYLEREF works ok initially, but if the number in the cell is changed from what I put in initially, the STYLEREF field is not updated until I manually update it. Is there way to make it update instantly?

    Thanks

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    Quote Originally Posted by Vincenzo View Post
    I see that STYLEREF works ok initially, but if the number in the cell is changed from what I put in initially, the STYLEREF field is not updated until I manually update it. Is there way to make it update instantly?
    When you give a user a form control to fill in, you can attach code to the control to update references to the value of the control. But with ordinary text, no, Word will not refresh fields until a significant event occurs, such as Print Preview, or the fields are refreshed either manually or in code.

    I have read that there is a way to run code on a timer so that you could, for example, refresh all the fields every minute or so. I've never done such a thing, so I don't know the mechanics of it or impact on performance. Here's an old post referring to how one might do this: [topic=442843]Timer object in Word?[/topic].

  6. #6
    5 Star Lounger Vincenzo's Avatar
    Join Date
    Mar 2004
    Posts
    654
    Thanks
    95
    Thanked 14 Times in 13 Posts
    OK thanks for that info. I'll take a look.

  7. #7
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    Expanding on one of Jefferson's suggestions, you could update the fields 'manually', but make that update easier by having a macro to do it - you could assign a keystroke combination to trigger the macro, or put it on a custom toolbar.

    Code like the following will update all fields in the main content part of the document:

    Code:
    Sub UpdateDocFields()
       ActiveDocument.Fields.Update
    End Sub
    Gary

  8. #8
    4 Star Lounger
    Join Date
    Jan 2010
    Location
    Chichester, UK
    Posts
    401
    Thanks
    1
    Thanked 10 Times in 9 Posts
    If this is a form and you need it protected, it adds a totally different dimension. What may work is if you use Text From Fields for text entry, you can assign the Form Field a bookmark name (Right-click the Form Field for options). You can then use the FF Bookmark to propogate its contents throughout the document. You may need to use an On Exit macro to Unprotect, update and reprotect the document.

    Terry

  9. #9
    5 Star Lounger Vincenzo's Avatar
    Join Date
    Mar 2004
    Posts
    654
    Thanks
    95
    Thanked 14 Times in 13 Posts
    Terry,
    This is not a form, and in fact it needs to stay unprotected so it can be edited.

    Gary,
    Thanks for the code. I'm not familiar with using macros, but I will take a look into it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •