Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
MO MO is offline
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
MO MO is offline
external usenet poster
 
Posts: 31
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2007 FILENAME field code - how to update automatically? rgille Microsoft Word Help 1 June 16th 08 04:07 AM
Word merge template - field code off Karen Microsoft Word Help 1 December 28th 06 09:00 PM
TOC field code problem Shana Microsoft Word Help 2 October 18th 06 05:53 PM
How to update ASK field code automatically when opening the doc? Paola Microsoft Word Help 1 January 3rd 06 10:54 AM
Ho do I add a company name field code to normal envelope template siggi Mailmerge 1 April 30th 05 05:39 AM


All times are GMT +1. The time now is 08:31 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"