How to have the same text in multiple places be changed or refactored at once?












5















I have a document with a variable being referred to several times on different pages. This is the same variable and so its value is the same on each page. If I need to change this variable I would like to be able change it only in one place and have this change all the other instances of this variable. Similar to when you refactor a variable in code. I can do a find and replace, but the problem is when I have several variables with the same value the find and replace will not differentiate between them, meaning I would need to click through every instance manually and decide if to replace that instance or not.



Is there a way to insert text or mark it in some way so that the document knows that this piece of text is the same as other instances and that changing one changes all others. This is similar to how text in the header and footers work, where changing one header changes all of them, except this would be in the body of the document.










share|improve this question



























    5















    I have a document with a variable being referred to several times on different pages. This is the same variable and so its value is the same on each page. If I need to change this variable I would like to be able change it only in one place and have this change all the other instances of this variable. Similar to when you refactor a variable in code. I can do a find and replace, but the problem is when I have several variables with the same value the find and replace will not differentiate between them, meaning I would need to click through every instance manually and decide if to replace that instance or not.



    Is there a way to insert text or mark it in some way so that the document knows that this piece of text is the same as other instances and that changing one changes all others. This is similar to how text in the header and footers work, where changing one header changes all of them, except this would be in the body of the document.










    share|improve this question

























      5












      5








      5


      1






      I have a document with a variable being referred to several times on different pages. This is the same variable and so its value is the same on each page. If I need to change this variable I would like to be able change it only in one place and have this change all the other instances of this variable. Similar to when you refactor a variable in code. I can do a find and replace, but the problem is when I have several variables with the same value the find and replace will not differentiate between them, meaning I would need to click through every instance manually and decide if to replace that instance or not.



      Is there a way to insert text or mark it in some way so that the document knows that this piece of text is the same as other instances and that changing one changes all others. This is similar to how text in the header and footers work, where changing one header changes all of them, except this would be in the body of the document.










      share|improve this question














      I have a document with a variable being referred to several times on different pages. This is the same variable and so its value is the same on each page. If I need to change this variable I would like to be able change it only in one place and have this change all the other instances of this variable. Similar to when you refactor a variable in code. I can do a find and replace, but the problem is when I have several variables with the same value the find and replace will not differentiate between them, meaning I would need to click through every instance manually and decide if to replace that instance or not.



      Is there a way to insert text or mark it in some way so that the document knows that this piece of text is the same as other instances and that changing one changes all others. This is similar to how text in the header and footers work, where changing one header changes all of them, except this would be in the body of the document.







      microsoft-word






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 7 '17 at 2:25









      FrontEndFrontEnd

      12814




      12814






















          1 Answer
          1






          active

          oldest

          votes


















          7














          A standard way to handle repeated text is to use bookmarks in conjunction with REF fields. Each bit of repeated text is stored in a bookmark, and each repetition of that text is inserted via a REF field that is linked to the bookmark. So it doesn't matter if two bookmarks happen to store identical looking text at a given time.




          1. Select the text that needs to be repeated, and insert a bookmark (on the Insert tab, in the Links group, click Bookmark).

          2. At each place where you need the text repeated, insert a REF field (on the Insert tab, in the Text group, click Quick Parts > Field, select Ref, and then select the name of the bookmark in the list).

          3. After you change the bookmarked text, select the whole document, and then press F9 to update the REF fields.


          As came up in another recent question, it helps if you make bookmarks visible if they aren't (click File > Options > Advanced, and then, under Show document content, select Show bookmarks). Otherwise, when you change the text, some of the new text might end up outside the bookmark, and your changes won't be propagated. When the bookmarks are visible, you can see whether all the new text is correctly inside the bookmark.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1206774%2fhow-to-have-the-same-text-in-multiple-places-be-changed-or-refactored-at-once%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            7














            A standard way to handle repeated text is to use bookmarks in conjunction with REF fields. Each bit of repeated text is stored in a bookmark, and each repetition of that text is inserted via a REF field that is linked to the bookmark. So it doesn't matter if two bookmarks happen to store identical looking text at a given time.




            1. Select the text that needs to be repeated, and insert a bookmark (on the Insert tab, in the Links group, click Bookmark).

            2. At each place where you need the text repeated, insert a REF field (on the Insert tab, in the Text group, click Quick Parts > Field, select Ref, and then select the name of the bookmark in the list).

            3. After you change the bookmarked text, select the whole document, and then press F9 to update the REF fields.


            As came up in another recent question, it helps if you make bookmarks visible if they aren't (click File > Options > Advanced, and then, under Show document content, select Show bookmarks). Otherwise, when you change the text, some of the new text might end up outside the bookmark, and your changes won't be propagated. When the bookmarks are visible, you can see whether all the new text is correctly inside the bookmark.






            share|improve this answer




























              7














              A standard way to handle repeated text is to use bookmarks in conjunction with REF fields. Each bit of repeated text is stored in a bookmark, and each repetition of that text is inserted via a REF field that is linked to the bookmark. So it doesn't matter if two bookmarks happen to store identical looking text at a given time.




              1. Select the text that needs to be repeated, and insert a bookmark (on the Insert tab, in the Links group, click Bookmark).

              2. At each place where you need the text repeated, insert a REF field (on the Insert tab, in the Text group, click Quick Parts > Field, select Ref, and then select the name of the bookmark in the list).

              3. After you change the bookmarked text, select the whole document, and then press F9 to update the REF fields.


              As came up in another recent question, it helps if you make bookmarks visible if they aren't (click File > Options > Advanced, and then, under Show document content, select Show bookmarks). Otherwise, when you change the text, some of the new text might end up outside the bookmark, and your changes won't be propagated. When the bookmarks are visible, you can see whether all the new text is correctly inside the bookmark.






              share|improve this answer


























                7












                7








                7







                A standard way to handle repeated text is to use bookmarks in conjunction with REF fields. Each bit of repeated text is stored in a bookmark, and each repetition of that text is inserted via a REF field that is linked to the bookmark. So it doesn't matter if two bookmarks happen to store identical looking text at a given time.




                1. Select the text that needs to be repeated, and insert a bookmark (on the Insert tab, in the Links group, click Bookmark).

                2. At each place where you need the text repeated, insert a REF field (on the Insert tab, in the Text group, click Quick Parts > Field, select Ref, and then select the name of the bookmark in the list).

                3. After you change the bookmarked text, select the whole document, and then press F9 to update the REF fields.


                As came up in another recent question, it helps if you make bookmarks visible if they aren't (click File > Options > Advanced, and then, under Show document content, select Show bookmarks). Otherwise, when you change the text, some of the new text might end up outside the bookmark, and your changes won't be propagated. When the bookmarks are visible, you can see whether all the new text is correctly inside the bookmark.






                share|improve this answer













                A standard way to handle repeated text is to use bookmarks in conjunction with REF fields. Each bit of repeated text is stored in a bookmark, and each repetition of that text is inserted via a REF field that is linked to the bookmark. So it doesn't matter if two bookmarks happen to store identical looking text at a given time.




                1. Select the text that needs to be repeated, and insert a bookmark (on the Insert tab, in the Links group, click Bookmark).

                2. At each place where you need the text repeated, insert a REF field (on the Insert tab, in the Text group, click Quick Parts > Field, select Ref, and then select the name of the bookmark in the list).

                3. After you change the bookmarked text, select the whole document, and then press F9 to update the REF fields.


                As came up in another recent question, it helps if you make bookmarks visible if they aren't (click File > Options > Advanced, and then, under Show document content, select Show bookmarks). Otherwise, when you change the text, some of the new text might end up outside the bookmark, and your changes won't be propagated. When the bookmarks are visible, you can see whether all the new text is correctly inside the bookmark.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered May 7 '17 at 4:00









                cnreadcnread

                1,791248




                1,791248






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1206774%2fhow-to-have-the-same-text-in-multiple-places-be-changed-or-refactored-at-once%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Plaza Victoria

                    In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

                    How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...