Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Problem: Template Field Code unlinks automatically
Hi,
the following is a solution to in a template file link to another file which is in a location relative to the template. {HYPERLINK "{template \p}\\..\\..\\Disbursement%20Request.docx"} The problem is that when the template is saved and reopened, the template field code has changed to a static [path]\normal.dotm. It seems like Word 2007 automatically unlinks the template field already at time of Save of the template (I think so because the template name is set to normal) I would like the path and filename to translate first when a new document is created from the template. I have unchecked "Update links on save" under "Web options". Can this be solved? Thanks P |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Problem: Template Field Code unlinks automatically
I do not know of a simple way to achieve this without code, but if your
template is a Word 2007 template (.dotx), the following approach /may/ be workable: The overview is: a. use a field that generates an error instead of the field you want. Th is field should be preserved the first time you save it b. save the .dotx c. edit the document.xml file contained in the .dotx to change the text of the field code to the one you want So, e.g.... a. Add the Hyperlink field(s) you want immediately before saving the ..dotx, using ctrl-F9 to insert the special field code braces. But instead of using { template \p }, insert e.g. { CHANGEME } (you must not have used a bookmark called CHANGEME anywhere for this to work). SO you have e.g. { HYPERLINK "{ CHANGEME }followed by the other text you want" } Select each of these hyperlinks and press F9 to update the field b. save and close your .dotx - let's say it is mytemplate.dotx c. in Windows Explorer/My computer/whatever, locate mytemplate.dotx and make a backup copy. d. rename mytemplate.dotx to mytemplate.zip e. open the .zip. Open the word folder inside it. Drag the document.xml file to a folder and open it, e.g. in Notepad. f. search for CHANGEME and change it to TEMPLATE \p g. copy/paste the document.xml back into that word folder within the zip file h. close any windows that show the contents of the zip file i. rename the .zip back to a .dotx j. open the template, or a document based on it k. select and update the HYPERLINK fields. Trouble is that even if you get it to work, a. this is probably not how Word "expects" things to be, so all sorts of unexpected problems may occur or a Word update might invalidate this approach, especially if someone thinks it is a security risk b. each time you save your .dotx you will probably need to redo this, so if you need to do it a lot you will probably need to write some code to help you anyway. Peter Jamieson http://tips.pjmsn.me.uk Visit Londinium at http://www.ralphwatson.tv On 06/10/2009 17:53, Mo wrote: Hi, the following is a solution to in a template file link to another file which is in a location relative to the template. {HYPERLINK "{template \p}\\..\\..\\Disbursement%20Request.docx"} The problem is that when the template is saved and reopened, the template field code has changed to a static [path]\normal.dotm. It seems like Word 2007 automatically unlinks the template field already at time of Save of the template (I think so because the template name is set to normal) I would like the path and filename to translate first when a new document is created from the template. I have unchecked "Update links on save" under "Web options". Can this be solved? Thanks P |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Problem: Template Field Code unlinks automatically
Thank you for your effort. But as you state, it might not be a solution to
rely on. /p "Peter Jamieson" wrote: I do not know of a simple way to achieve this without code, but if your template is a Word 2007 template (.dotx), the following approach /may/ be workable: The overview is: a. use a field that generates an error instead of the field you want. Th is field should be preserved the first time you save it b. save the .dotx c. edit the document.xml file contained in the .dotx to change the text of the field code to the one you want So, e.g.... a. Add the Hyperlink field(s) you want immediately before saving the ..dotx, using ctrl-F9 to insert the special field code braces. But instead of using { template \p }, insert e.g. { CHANGEME } (you must not have used a bookmark called CHANGEME anywhere for this to work). SO you have e.g. { HYPERLINK "{ CHANGEME }followed by the other text you want" } Select each of these hyperlinks and press F9 to update the field b. save and close your .dotx - let's say it is mytemplate.dotx c. in Windows Explorer/My computer/whatever, locate mytemplate.dotx and make a backup copy. d. rename mytemplate.dotx to mytemplate.zip e. open the .zip. Open the word folder inside it. Drag the document.xml file to a folder and open it, e.g. in Notepad. f. search for CHANGEME and change it to TEMPLATE \p g. copy/paste the document.xml back into that word folder within the zip file h. close any windows that show the contents of the zip file i. rename the .zip back to a .dotx j. open the template, or a document based on it k. select and update the HYPERLINK fields. Trouble is that even if you get it to work, a. this is probably not how Word "expects" things to be, so all sorts of unexpected problems may occur or a Word update might invalidate this approach, especially if someone thinks it is a security risk b. each time you save your .dotx you will probably need to redo this, so if you need to do it a lot you will probably need to write some code to help you anyway. Peter Jamieson http://tips.pjmsn.me.uk Visit Londinium at http://www.ralphwatson.tv On 06/10/2009 17:53, Mo wrote: Hi, the following is a solution to in a template file link to another file which is in a location relative to the template. {HYPERLINK "{template \p}\\..\\..\\Disbursement%20Request.docx"} The problem is that when the template is saved and reopened, the template field code has changed to a static [path]\normal.dotm. It seems like Word 2007 automatically unlinks the template field already at time of Save of the template (I think so because the template name is set to normal) I would like the path and filename to translate first when a new document is created from the template. I have unchecked "Update links on save" under "Web options". Can this be solved? Thanks P |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Word 2007 FILENAME field code - how to update automatically? | Microsoft Word Help | |||
Word merge template - field code off | Microsoft Word Help | |||
TOC field code problem | Microsoft Word Help | |||
How to update ASK field code automatically when opening the doc? | Microsoft Word Help | |||
Ho do I add a company name field code to normal envelope template | Mailmerge |