Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-16-2015, 08:54 AM
kwstewart kwstewart is offline INCLUDETEXT dynamic file name? Mac OS X INCLUDETEXT dynamic file name? Office for Mac 2011
Novice
INCLUDETEXT dynamic file name?
 
Join Date: Aug 2015
Posts: 2
kwstewart is on a distinguished road
Default 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!!
Reply With Quote
  #2  
Old 08-16-2015, 09:14 PM
gmayor's Avatar
gmayor gmayor is offline INCLUDETEXT dynamic file name? Windows 7 64bit INCLUDETEXT dynamic file name? Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
  #3  
Old 08-16-2015, 10:11 PM
macropod's Avatar
macropod macropod is offline INCLUDETEXT dynamic file name? Windows 7 64bit INCLUDETEXT dynamic file name? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #4  
Old 08-17-2015, 09:04 AM
kwstewart kwstewart is offline INCLUDETEXT dynamic file name? Mac OS X INCLUDETEXT dynamic file name? Office for Mac 2011
Novice
INCLUDETEXT dynamic file name?
 
Join Date: Aug 2015
Posts: 2
kwstewart is on a distinguished road
Default

Thank you!
Reply With Quote
Reply

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
INCLUDETEXT dynamic file name? 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
INCLUDETEXT dynamic file name? 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

Other Forums: Access Forums

All times are GMT -7. The time now is 01:49 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft