#1
|
|||
|
|||
INCLUDETEXT dynamic file name?
Is it possible to have the file name for the INCLUDETEXT dynamically set using one of the merge fields?
Something like: INCLUDETEXT MERGEFIELD filename rather than INCLUDETEXT test.doc Here is a sample of the code we currently have and we'd like to pass in the file name using the merge data rather than hard coding all of this. { IF { MERGEFIELD Lettertype \* FirstCap \* CHARFORMAT} = "Autumn Crisp" { INCLUDETEXT c:\\ECMarketing\\doc\\Autumn-fact.doc \* MERGEFORMAT } } { IF { MERGEFIELD Lettertype \* FirstCap \* CHARFORMAT} = "CandyCrisp" { INCLUDETEXT c:\\ECMarketing\\doc\\Candycrisp-fact.doc \* MERGEFORMAT } } { IF { MERGEFIELD Lettertype \* FirstCap \* CHARFORMAT} = "Cortland" { INCLUDETEXT c:\\ECMarketing\\doc\\Cortland-fact.doc \* MERGEFORMAT } } { IF { MERGEFIELD Lettertype \* FirstCap \* CHARFORMAT} = "Empire" { INCLUDETEXT c:\\ECMarketing\\doc\\Empire-fact.doc \* MERGEFORMAT } } { IF { MERGEFIELD Lettertype \* FirstCap \* CHARFORMAT} = "Fortune" { INCLUDETEXT c:\\ECMarketing\\doc\\Fortune-fact.doc \* MERGEFORMAT } } { IF { MERGEFIELD Lettertype \* FirstCap \* CHARFORMAT} = "Fuji" { INCLUDETEXT c:\\ECMarketing\\doc\\Fuji-fact.doc \* MERGEFORMAT } } I've been researching this and can't find any examples using a merge field for the file name. Thank you!! |
#2
|
||||
|
||||
If you match the value "Autumn Crisp" in the LetterType data field to the name of the document (or vice versa) you can use
{ INCLUDETEXT "C:\\ECMarketing\\doc\\{ MERGEFIELD LetterType }-fact.doc" }
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
||||
|
||||
If you use a compound field coded as:
{QUOTE{INCLUDETEXT "C:\\ECMarketing\\doc\\{ MERGEFIELD LetterType }-fact.doc" }} not only will the appropriate data be inserted but also the link to the external file will be broken, so the output document can be used without recourse to it.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
Thank you!
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Conditional INCLUDETEXT based on data merge | Kavo | Mail Merge | 6 | 05-08-2015 07:44 AM |
problem with includetext | bosskardo | Mail Merge | 1 | 11-21-2014 12:27 AM |
ERROR with INCLUDETEXT | jjian | Mail Merge | 5 | 10-21-2014 01:34 PM |
Word 2010 Includetext not automatically updating | nataliec | Word | 4 | 12-13-2012 02:37 PM |
IncludeText | kenglade | Word | 6 | 12-05-2011 02:47 PM |