• Updating sub-doc fields but not sub-doc itself (Word 2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Updating sub-doc fields but not sub-doc itself (Word 2003)

    Author
    Topic
    #413822

    Here I am again, humbly asking advice on what appears to me as a sticky problem. My question today is how to update SEQ fields in an included document without refreshing the full included document.

    Background: my main document uses an INCLUDETEXT field to bring in the contents of a sub-document. The sub-document contains a procedure whose steps are numbered via SEQ fields. Some paragraphs in the sub-doc are marked with a style called UG Only. The idea is that when the sub-doc is included in the user’s guide, all steps are used; but when included in the Getting Started document, I search for and delete all text marked UG Only.

    With me so far? The problem is that, in the sub-doc, some of the paragraphs marked with the UG Only style are procedure steps with SEQ fields. Suppose that step 3 is marked UG Only — I want it to appear in the user’s guide but not in Getting Started. When I’m generating the Getting Started doc, I use find/replace to delete all UG Only text. So I’m left with a procedure whose steps are numbered 1, 2, 4. So far so good, but now I want Word to re-number the sequence in some automated way. The only way I can think of to do that is to select the included sub-doc and press F9. Unfortunately, that updates the INCLUDETEXT field rather than the included SEQs, causing the previously-deleted step 3 to re-appear.

    So the question is this: is there another way to tell Word to refresh the values of the fields in the sub-doc without refreshing the sub-doc itself? I want to keep step 3 in the sub-doc, since it still applies when included in the user guide. I hope I don’t have to maintain separate versions of the sub-doc, or have one sub-doc containing steps 1 & 2 and another containing step 4, but I can’t think of any other way to do it. Anybody have any ideas? Thanks so much (I really appreciate all the advice I’ve received in this forum), and happy holidays to those of you celebrating them this week.

    Bruce Watson

    Viewing 5 reply threads
    Author
    Replies
    • #915715

      I tried a short macro that included a loop…

      For Each fldNext In ActiveDocument.Fields
      If fldNext.Type = wdFieldSequence Then fldNext.Update
      Next fldNext

      but as soon as it updated a single Sequence field it also updated the entire IncludeText field, I have no idea why.

      I then tried .Unlink on the IncludeText field, but this also unlinked all the SEQ fields! This is going to be hard!

      StuartR

    • #915716

      I tried a short macro that included a loop…

      For Each fldNext In ActiveDocument.Fields
      If fldNext.Type = wdFieldSequence Then fldNext.Update
      Next fldNext

      but as soon as it updated a single Sequence field it also updated the entire IncludeText field, I have no idea why.

      I then tried .Unlink on the IncludeText field, but this also unlinked all the SEQ fields! This is going to be hard!

      StuartR

    • #915717

      If it’s a matter of changing the document temporarily to print the Getting Started guide, you can do it as follows:
      – Open the main doc.
      – Open the subdoc in a separate window.
      – Delete the UG paragraphs in the subdoc.
      – Switch to the main doc window.
      – Click anywhere in the subdoc.
      – Press F9 to update.
      – Print.
      – Close both windows without saving.
      If you want a permanent version of the Getting Started guide, you’ll need a separate version of the subdoc. I don’t see a way around that. You can write a macro to generate the Getting Started version of the subdoc from the complete version.

    • #915718

      If it’s a matter of changing the document temporarily to print the Getting Started guide, you can do it as follows:
      – Open the main doc.
      – Open the subdoc in a separate window.
      – Delete the UG paragraphs in the subdoc.
      – Switch to the main doc window.
      – Click anywhere in the subdoc.
      – Press F9 to update.
      – Print.
      – Close both windows without saving.
      If you want a permanent version of the Getting Started guide, you’ll need a separate version of the subdoc. I don’t see a way around that. You can write a macro to generate the Getting Started version of the subdoc from the complete version.

    • #915724

      Single sourcing with Word has a few problems and this is one of them. Since you are doing a delete activity anyway then why don’t you just use a middle man to do your dirty work.
      1. Update and maintain the UG master as per normal
      2. Duplicate the UG called ‘UG for GSG’, do the search and destroy to kill off the unwanted styles and then update the fields
      3. Modify the links in the GSG to point at the ‘UG for GSG’ file

      Next time you make changes to the UG and want the changes reflected in the GSG then you repeat step 2 (overwriting the existing one) and then update the links in the GSG.

      Note: there is no link between UG and the UG for GSG. The UG for GSG should be replaced everytime you want the GSG rebuilt. This can be easily achieved with a simple macro to automate step 2.

    • #915753

      Hi,
      I’d like to suggest a differenct approach: Instead of deleting all the text that is in the style UG Only, redefine the style to be hidden. You can then save the sub-document. You won’t have lost any text, only hidden it.
      This leaves the problem of the sequence numbers. I’d approach this with a macro that converts the sequence number switch n to c if it is in the UG Only Style (this prevents it from incrementing) (or use search and replace)
      When you need the sub-document for the user guide, redefine the style to not hidden, convert the seq switches back to n and all will be well again.
      Regards,
      Judith

      • #915908

        Hi Judith:
        That’s an interesting approach. I tried it, but maybe I don’t understand your last step correctly. If, in the target document, I replace the {SEQ A n } fields with {SEQ A c} fields for the UG style, the numbers will not change until the SEQ field is updated. As soon, as I try to update the SEQ field, the entire Includetext field updates (which changes the switch in the SEQ field & changes the style UG back to unhidden). Am I missing one of your steps?

        • #915937

          Phil — I think she meant that you’d change the SEQ fields in the sub-doc, then get the SEQs to update and save the sub-doc. Then you’d generate the Getting Started doc. When it’s done, you’d go back and restore the sub-doc (un-hiding & resetting the switches) and re-save the sub-doc. Does that sound right, Judith?

          Bruce Watson

          • #915941

            All — thanks for the great ideas. Judith’s solution is indeed interesting and clever, but I’m probably going to go with some form of Hans’ idea. Thanks again, though, to all of you.

            Bruce Watson

          • #915942

            All — thanks for the great ideas. Judith’s solution is indeed interesting and clever, but I’m probably going to go with some form of Hans’ idea. Thanks again, though, to all of you.

            Bruce Watson

          • #915945

            Thanks for the explanation, Bruce. I don’t use the Master Doc/SubDoc feature, so I’m somewhat unfamiliar with it. If you plan to stick with that feature, you should read Why Master Documents Corrupt.
            Cheers,

          • #915946

            Thanks for the explanation, Bruce. I don’t use the Master Doc/SubDoc feature, so I’m somewhat unfamiliar with it. If you plan to stick with that feature, you should read Why Master Documents Corrupt.
            Cheers,

        • #915938

          Phil — I think she meant that you’d change the SEQ fields in the sub-doc, then get the SEQs to update and save the sub-doc. Then you’d generate the Getting Started doc. When it’s done, you’d go back and restore the sub-doc (un-hiding & resetting the switches) and re-save the sub-doc. Does that sound right, Judith?

          Bruce Watson

      • #915909

        Hi Judith:
        That’s an interesting approach. I tried it, but maybe I don’t understand your last step correctly. If, in the target document, I replace the {SEQ A n } fields with {SEQ A c} fields for the UG style, the numbers will not change until the SEQ field is updated. As soon, as I try to update the SEQ field, the entire Includetext field updates (which changes the switch in the SEQ field & changes the style UG back to unhidden). Am I missing one of your steps?

    Viewing 5 reply threads
    Reply To: Updating sub-doc fields but not sub-doc itself (Word 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: