Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]() 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 | |
|
|
![]() |
||||
Thread | Forum | |||
conditional field layouts | Mailmerge | |||
HOW DO I SET UP A CONDITIONAL FORMAT TO A FIELD | Mailmerge | |||
Conditional Wordart via Mailmerge-Field? | Mailmerge | |||
Link a Field to an Embedded Worksheet & have the link follow "save | Microsoft Word Help | |||
Conditional merging a field and formating it | Mailmerge |