VBA insert text into enclosed bookmark, then select inserted text and "reset" the enclosed bookmark
Posted on 2009-07-08
I'm not sure if this is the best approach for doing this, so if you have a better one, please feel free to suggest it.
I have a document with a bookmark set up. I am using the bookmark to insert a PROJECT_NAME into the document. I then add lots of stuff to the document, text, tables, figures, etc. When I want to refer to the PROJECT_NAME in the rest of the document, I have the string 'PROJECT_NAME'. What I need to do is find all of these occurrences and insert a field that references the value I first inserted into the enclosed bookmark, call this the lookup value. This includes the Headers of the pages as well.
This way, if the 'lookup value' is changed after the document is finished being created, all the occurrences can be easily updated.
I need the solution in VBA code.
Thanks in advance for any help,