Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
TishyMouse TishyMouse is offline
external usenet poster
 
Posts: 7
Default Using a conditional parameter within the LINK field

I have a Word document that includes links to a number of tables in an Excel
spreadsheet. The links are defined in terms of defined names in the
spreadsheet. I'd like to be able to link to different tables depending on the
value of a custom property in the Word document but I can't get this to work.

e.g. the following works OK:
{LINK Excel.Sheet.8 \\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK
\f 0 \p}

but I'd like to use something like
{LINK Excel.Sheet.8 \\\\domain.com\\mypath\\MyExcelFile.xls
MySheet!Name_{DOCPROPERTY Region} \f 0 \p}

Where the names Name_UK, Name_US etc. are defined within the Excel sheet and
'Region' is a property of the Word document.

However it doesn't work at least with this syntax (I just get an 'Error! Not
a valid link' message). Does Word actually support this or does anyone know a
different way to implement this functionality? I realise one alternative
would be to have a number of nested {IF } statements for the different
regions but that will get very messy and hard to maintain.


TIA

TishyMouse
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Using a conditional parameter within the LINK field

Hi TishyMouse,

Unfortunately, the approach you're after won't work as any field within a LINK field gets converted to its result the first time the
LINK field is updated. Consequently, you'll need to use IF tests coded along the lines of:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p} {LINK
Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}
or:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p}}
{IF{DOCPROPERTY Region}= "US" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message. Note also the addition of the double quotes in the LINK fields - their omission may have had something to do
with your field's failure.


--
Cheers
macropod
[Microsoft MVP - Word]


"TishyMouse" wrote in message ...
I have a Word document that includes links to a number of tables in an Excel
spreadsheet. The links are defined in terms of defined names in the
spreadsheet. I'd like to be able to link to different tables depending on the
value of a custom property in the Word document but I can't get this to work.

e.g. the following works OK:
{LINK Excel.Sheet.8 \\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK
\f 0 \p}

but I'd like to use something like
{LINK Excel.Sheet.8 \\\\domain.com\\mypath\\MyExcelFile.xls
MySheet!Name_{DOCPROPERTY Region} \f 0 \p}

Where the names Name_UK, Name_US etc. are defined within the Excel sheet and
'Region' is a property of the Word document.

However it doesn't work at least with this syntax (I just get an 'Error! Not
a valid link' message). Does Word actually support this or does anyone know a
different way to implement this functionality? I realise one alternative
would be to have a number of nested {IF } statements for the different
regions but that will get very messy and hard to maintain.


TIA

TishyMouse


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Using a conditional parameter within the LINK field

Hi TishyMouse,

Unfortunately, the approach you're after won't work as any field within a LINK field gets converted to its result the first time the
LINK field is updated. Consequently, you'll need to use IF tests coded along the lines of:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p} {LINK
Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}
or:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p}}
{IF{DOCPROPERTY Region}= "US" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message. Note also the addition of the double quotes in the LINK fields - their omission may have had something to do
with your field's failure.


--
Cheers
macropod
[Microsoft MVP - Word]


"TishyMouse" wrote in message ...
I have a Word document that includes links to a number of tables in an Excel
spreadsheet. The links are defined in terms of defined names in the
spreadsheet. I'd like to be able to link to different tables depending on the
value of a custom property in the Word document but I can't get this to work.

e.g. the following works OK:
{LINK Excel.Sheet.8 \\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK
\f 0 \p}

but I'd like to use something like
{LINK Excel.Sheet.8 \\\\domain.com\\mypath\\MyExcelFile.xls
MySheet!Name_{DOCPROPERTY Region} \f 0 \p}

Where the names Name_UK, Name_US etc. are defined within the Excel sheet and
'Region' is a property of the Word document.

However it doesn't work at least with this syntax (I just get an 'Error! Not
a valid link' message). Does Word actually support this or does anyone know a
different way to implement this functionality? I realise one alternative
would be to have a number of nested {IF } statements for the different
regions but that will get very messy and hard to maintain.


TIA

TishyMouse


  #4   Report Post  
Posted to microsoft.public.word.docmanagement
peter petrelli peter petrelli is offline
external usenet poster
 
Posts: 2
Default Multiplicaion in a linked field

Hi macropod,

My word field code reads

{ LINK Excel.Sheet.8 "D:\\uev\\Documents and Settings\\bb\\Desktop\\file.xlsx" "Hybrid!R3C40" \a \t }

I want to multiply 100 to this value. Can you please give me the code for this? I am quite new to Field codes. Thanks!



macropod wrote:

Hi TishyMouse,Unfortunately, the approach you are after will not work as any
19-Mar-10

Hi TishyMouse,

Unfortunately, the approach you are after will not work as any field within a LINK field gets converted to its result the first time the
LINK field is updated. Consequently, you will need to use IF tests coded along the lines of:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p} {LINK
Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}
or:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p}}
{IF{DOCPROPERTY Region}= "US" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you cannot simply type them or copy & paste
them from this message. Note also the addition of the double quotes in the LINK fields - their omission may have had something to do
with your field's failure.


--
Cheers
macropod
[Microsoft MVP - Word]

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
BizTalk Repeating Structures Table Looping and Table Extract
http://www.eggheadcafe.com/tutorials...g-structu.aspx
  #5   Report Post  
Posted to microsoft.public.word.docmanagement
peter petrelli peter petrelli is offline
external usenet poster
 
Posts: 2
Default Multiplicaion in a linked field

Hi macropod,

My word field code reads

{ LINK Excel.Sheet.8 "D:\\uev\\Documents and Settings\\bb\\Desktop\\file.xlsx" "Hybrid!R3C40" \a \t }

I want to multiply 100 to this value. Can you please give me the code for this? I am quite new to Field codes. Thanks!



macropod wrote:

Hi TishyMouse,Unfortunately, the approach you are after will not work as any
19-Mar-10

Hi TishyMouse,

Unfortunately, the approach you are after will not work as any field within a LINK field gets converted to its result the first time the
LINK field is updated. Consequently, you will need to use IF tests coded along the lines of:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p} {LINK
Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}
or:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p}}
{IF{DOCPROPERTY Region}= "US" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you cannot simply type them or copy & paste
them from this message. Note also the addition of the double quotes in the LINK fields - their omission may have had something to do
with your field's failure.


--
Cheers
macropod
[Microsoft MVP - Word]

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
BizTalk Repeating Structures Table Looping and Table Extract
http://www.eggheadcafe.com/tutorials...g-structu.aspx


  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Multiplicaion in a linked field

Use the following field construction

{ = { LINK Excel.Sheet.8 "D:\\uev\\Documents and
Settings\\bb\\Desktop\\file.xlsx" "Hybrid!R3C40" \a \t } * 100 }

Select your existing link, then use Ctrl+F9 to enclose it in a second pair
of field delimiters and then inser the = and the * 100 in the places as
shown above.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"peter petrelli" wrote in message ...
Hi macropod,

My word field code reads

{ LINK Excel.Sheet.8 "D:\\uev\\Documents and
Settings\\bb\\Desktop\\file.xlsx" "Hybrid!R3C40" \a \t }

I want to multiply 100 to this value. Can you please give me the code for
this? I am quite new to Field codes. Thanks!



macropod wrote:

Hi TishyMouse,Unfortunately, the approach you are after will not work as
any
19-Mar-10

Hi TishyMouse,

Unfortunately, the approach you are after will not work as any field
within a LINK field gets converted to its result the first time the
LINK field is updated. Consequently, you will need to use IF tests coded
along the lines of:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8
"\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p} {LINK
Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f
0 \p}}
or:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8
"\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p}}
{IF{DOCPROPERTY Region}= "US" {LINK Excel.Sheet.8
"\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}

Note: The field brace pairs (ie '{ }') for the above example are created
via Ctrl-F9 - you cannot simply type them or copy & paste
them from this message. Note also the addition of the double quotes in the
LINK fields - their omission may have had something to do
with your field's failure.


--
Cheers
macropod
[Microsoft MVP - Word]

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
BizTalk Repeating Structures Table Looping and Table Extract
http://www.eggheadcafe.com/tutorials...g-structu.aspx


  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Multiplicaion in a linked field

Use the following field construction

{ = { LINK Excel.Sheet.8 "D:\\uev\\Documents and
Settings\\bb\\Desktop\\file.xlsx" "Hybrid!R3C40" \a \t } * 100 }

Select your existing link, then use Ctrl+F9 to enclose it in a second pair
of field delimiters and then inser the = and the * 100 in the places as
shown above.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"peter petrelli" wrote in message ...
Hi macropod,

My word field code reads

{ LINK Excel.Sheet.8 "D:\\uev\\Documents and
Settings\\bb\\Desktop\\file.xlsx" "Hybrid!R3C40" \a \t }

I want to multiply 100 to this value. Can you please give me the code for
this? I am quite new to Field codes. Thanks!



macropod wrote:

Hi TishyMouse,Unfortunately, the approach you are after will not work as
any
19-Mar-10

Hi TishyMouse,

Unfortunately, the approach you are after will not work as any field
within a LINK field gets converted to its result the first time the
LINK field is updated. Consequently, you will need to use IF tests coded
along the lines of:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8
"\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p} {LINK
Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f
0 \p}}
or:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8
"\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p}}
{IF{DOCPROPERTY Region}= "US" {LINK Excel.Sheet.8
"\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}

Note: The field brace pairs (ie '{ }') for the above example are created
via Ctrl-F9 - you cannot simply type them or copy & paste
them from this message. Note also the addition of the double quotes in the
LINK fields - their omission may have had something to do
with your field's failure.


--
Cheers
macropod
[Microsoft MVP - Word]

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
BizTalk Repeating Structures Table Looping and Table Extract
http://www.eggheadcafe.com/tutorials...g-structu.aspx


  #8   Report Post  
Posted to microsoft.public.word.docmanagement
TishyMouse TishyMouse is offline
external usenet poster
 
Posts: 7
Default Using a conditional parameter within the LINK field

Thanks for confirming that MP and saving my hair from more pulling out :-). I
guess I'll have to go back to the {IF} syntax (or perhaps investigate using a
macro to do a global search and replace).

By the way AFAIK the double quotes aren't necessary unless there is a space
in any of the parameter values. My first example {LINK Excel.Sheet.8
\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK \f 0 \p} works fine.

TM

"macropod" wrote:

Hi TishyMouse,

Unfortunately, the approach you're after won't work as any field within a LINK field gets converted to its result the first time the
LINK field is updated. Consequently, you'll need to use IF tests coded along the lines of:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p} {LINK
Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}
or:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p}}
{IF{DOCPROPERTY Region}= "US" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message. Note also the addition of the double quotes in the LINK fields - their omission may have had something to do
with your field's failure.


--
Cheers
macropod
[Microsoft MVP - Word]


"TishyMouse" wrote in message ...
I have a Word document that includes links to a number of tables in an Excel
spreadsheet. The links are defined in terms of defined names in the
spreadsheet. I'd like to be able to link to different tables depending on the
value of a custom property in the Word document but I can't get this to work.

e.g. the following works OK:
{LINK Excel.Sheet.8 \\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK
\f 0 \p}

but I'd like to use something like
{LINK Excel.Sheet.8 \\\\domain.com\\mypath\\MyExcelFile.xls
MySheet!Name_{DOCPROPERTY Region} \f 0 \p}

Where the names Name_UK, Name_US etc. are defined within the Excel sheet and
'Region' is a property of the Word document.

However it doesn't work at least with this syntax (I just get an 'Error! Not
a valid link' message). Does Word actually support this or does anyone know a
different way to implement this functionality? I realise one alternative
would be to have a number of nested {IF } statements for the different
regions but that will get very messy and hard to maintain.


TIA

TishyMouse


.

  #9   Report Post  
Posted to microsoft.public.word.docmanagement
TishyMouse TishyMouse is offline
external usenet poster
 
Posts: 7
Default Using a conditional parameter within the LINK field

Thanks for confirming that MP and saving my hair from more pulling out :-). I
guess I'll have to go back to the {IF} syntax (or perhaps investigate using a
macro to do a global search and replace).

By the way AFAIK the double quotes aren't necessary unless there is a space
in any of the parameter values. My first example {LINK Excel.Sheet.8
\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK \f 0 \p} works fine.

TM

"macropod" wrote:

Hi TishyMouse,

Unfortunately, the approach you're after won't work as any field within a LINK field gets converted to its result the first time the
LINK field is updated. Consequently, you'll need to use IF tests coded along the lines of:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p} {LINK
Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}
or:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p}}
{IF{DOCPROPERTY Region}= "US" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message. Note also the addition of the double quotes in the LINK fields - their omission may have had something to do
with your field's failure.


--
Cheers
macropod
[Microsoft MVP - Word]


"TishyMouse" wrote in message ...
I have a Word document that includes links to a number of tables in an Excel
spreadsheet. The links are defined in terms of defined names in the
spreadsheet. I'd like to be able to link to different tables depending on the
value of a custom property in the Word document but I can't get this to work.

e.g. the following works OK:
{LINK Excel.Sheet.8 \\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK
\f 0 \p}

but I'd like to use something like
{LINK Excel.Sheet.8 \\\\domain.com\\mypath\\MyExcelFile.xls
MySheet!Name_{DOCPROPERTY Region} \f 0 \p}

Where the names Name_UK, Name_US etc. are defined within the Excel sheet and
'Region' is a property of the Word document.

However it doesn't work at least with this syntax (I just get an 'Error! Not
a valid link' message). Does Word actually support this or does anyone know a
different way to implement this functionality? I realise one alternative
would be to have a number of nested {IF } statements for the different
regions but that will get very messy and hard to maintain.


TIA

TishyMouse


.

  #10   Report Post  
Posted to microsoft.public.word.docmanagement
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Using a conditional parameter within the LINK field

Hi TishyMouse,

Yes, it's true that the double quotes aren't *required* unless the filename or path has spaces. Using them as a matter of course is
good practice though and, in this case, guards against any changes in the way Word works treating the {DOCPROPERTY Region} field as
if it were not part of the file/path name string (this is more relevant to INCLUDETEXT and INCLUDEPICTURE fields since, as
previously discussed, you can't use a field variable in a LINK field). Do note that the lack of spaces in your filepath, filename
and sheet reference were not apparent from your post. Conversely, I should have had:
"\\\\domain.com\\mypath\\MyExcelFile.xls" MySheet!Name_US
or:
"\\\\domain.com\\mypath\\MyExcelFile.xls" "MySheet!Name_US"
and not:
"\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US"


--
Cheers
macropod
[Microsoft MVP - Word]


"TishyMouse" wrote in message ...
Thanks for confirming that MP and saving my hair from more pulling out :-). I
guess I'll have to go back to the {IF} syntax (or perhaps investigate using a
macro to do a global search and replace).

By the way AFAIK the double quotes aren't necessary unless there is a space
in any of the parameter values. My first example {LINK Excel.Sheet.8
\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK \f 0 \p} works fine.

TM

"macropod" wrote:

Hi TishyMouse,

Unfortunately, the approach you're after won't work as any field within a LINK field gets converted to its result the first time
the
LINK field is updated. Consequently, you'll need to use IF tests coded along the lines of:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p} {LINK
Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}
or:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p}}
{IF{DOCPROPERTY Region}= "US" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message. Note also the addition of the double quotes in the LINK fields - their omission may have had something to
do
with your field's failure.


--
Cheers
macropod
[Microsoft MVP - Word]


"TishyMouse" wrote in message ...
I have a Word document that includes links to a number of tables in an Excel
spreadsheet. The links are defined in terms of defined names in the
spreadsheet. I'd like to be able to link to different tables depending on the
value of a custom property in the Word document but I can't get this to work.

e.g. the following works OK:
{LINK Excel.Sheet.8 \\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK
\f 0 \p}

but I'd like to use something like
{LINK Excel.Sheet.8 \\\\domain.com\\mypath\\MyExcelFile.xls
MySheet!Name_{DOCPROPERTY Region} \f 0 \p}

Where the names Name_UK, Name_US etc. are defined within the Excel sheet and
'Region' is a property of the Word document.

However it doesn't work at least with this syntax (I just get an 'Error! Not
a valid link' message). Does Word actually support this or does anyone know a
different way to implement this functionality? I realise one alternative
would be to have a number of nested {IF } statements for the different
regions but that will get very messy and hard to maintain.


TIA

TishyMouse


.




  #11   Report Post  
Posted to microsoft.public.word.docmanagement
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Using a conditional parameter within the LINK field


Hi TishyMouse,

Yes, it's true that the double quotes aren't *required* unless the filename or path has spaces. Using them as a matter of course is
good practice though and, in this case, guards against any changes in the way Word works treating the {DOCPROPERTY Region} field as
if it were not part of the file/path name string (this is more relevant to INCLUDETEXT and INCLUDEPICTURE fields since, as
previously discussed, you can't use a field variable in a LINK field). Do note that the lack of spaces in your filepath, filename
and sheet reference were not apparent from your post. Conversely, I should have had:
"\\\\domain.com\\mypath\\MyExcelFile.xls" MySheet!Name_US
or:
"\\\\domain.com\\mypath\\MyExcelFile.xls" "MySheet!Name_US"
and not:
"\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US"


--
Cheers
macropod
[Microsoft MVP - Word]


"TishyMouse" wrote in message ...
Thanks for confirming that MP and saving my hair from more pulling out :-). I
guess I'll have to go back to the {IF} syntax (or perhaps investigate using a
macro to do a global search and replace).

By the way AFAIK the double quotes aren't necessary unless there is a space
in any of the parameter values. My first example {LINK Excel.Sheet.8
\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK \f 0 \p} works fine.

TM

"macropod" wrote:

Hi TishyMouse,

Unfortunately, the approach you're after won't work as any field within a LINK field gets converted to its result the first time
the
LINK field is updated. Consequently, you'll need to use IF tests coded along the lines of:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p} {LINK
Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}
or:
{IF{DOCPROPERTY Region}= "UK" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK" \f 0 \p}}
{IF{DOCPROPERTY Region}= "US" {LINK Excel.Sheet.8 "\\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_US" \f 0 \p}}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message. Note also the addition of the double quotes in the LINK fields - their omission may have had something to
do
with your field's failure.


--
Cheers
macropod
[Microsoft MVP - Word]


"TishyMouse" wrote in message ...
I have a Word document that includes links to a number of tables in an Excel
spreadsheet. The links are defined in terms of defined names in the
spreadsheet. I'd like to be able to link to different tables depending on the
value of a custom property in the Word document but I can't get this to work.

e.g. the following works OK:
{LINK Excel.Sheet.8 \\\\domain.com\\mypath\\MyExcelFile.xls MySheet!Name_UK
\f 0 \p}

but I'd like to use something like
{LINK Excel.Sheet.8 \\\\domain.com\\mypath\\MyExcelFile.xls
MySheet!Name_{DOCPROPERTY Region} \f 0 \p}

Where the names Name_UK, Name_US etc. are defined within the Excel sheet and
'Region' is a property of the Word document.

However it doesn't work at least with this syntax (I just get an 'Error! Not
a valid link' message). Does Word actually support this or does anyone know a
different way to implement this functionality? I realise one alternative
would be to have a number of nested {IF } statements for the different
regions but that will get very messy and hard to maintain.


TIA

TishyMouse


.


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
conditional field layouts Peter Mailmerge 2 September 14th 09 04:15 AM
HOW DO I SET UP A CONDITIONAL FORMAT TO A FIELD DOUG GARDNER Mailmerge 1 October 20th 08 12:28 AM
Conditional Wordart via Mailmerge-Field? Lüko Willms Mailmerge 3 October 13th 06 04:57 AM
Link a Field to an Embedded Worksheet & have the link follow "save Drew Microsoft Word Help 1 October 6th 06 10:13 AM
Conditional merging a field and formating it [email protected] Mailmerge 1 April 7th 06 08:02 PM


All times are GMT +1. The time now is 05:12 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"