Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Using INCLUDETEXT with a file that's not there.
Hi!
I'm trying to perform a merge in Word and pull in another document if the document exists and if not include a static text line. My problem is that I can't figure out a way to determine if the document is available. Is there any way in Word to see if a document is there before it pulls it into another document with the INCLUDETEXT field? Thank you so much in advance! |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Using INCLUDETEXT with a file that's not there.
As far as I know the best you can doing using fields alone is to use
{ IF "{ INCLUDETEXT "thepathname" }" = ""Error! Not a valid filename." "static text line" "{ INCLUDETEXT "thepathname" }" but then you will see a message box every time the file does not exist, and I do not think you can suppress those messages (easily, anyway). If you are using Word 2002/2003 you could use the mailmerge events to work out the filename and check its existence, then either insert an INCLUDETEXT, insert the file itself, or insert the static text line depending on the result. Peter Jamieson "GeeBee" wrote in message ... Hi! I'm trying to perform a merge in Word and pull in another document if the document exists and if not include a static text line. My problem is that I can't figure out a way to determine if the document is available. Is there any way in Word to see if a document is there before it pulls it into another document with the INCLUDETEXT field? Thank you so much in advance! |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Using INCLUDETEXT with a file that's not there.
Thank you so much! In the document format that I'm using, the error message
won't be a problem. Thank you again! "Peter Jamieson" wrote: As far as I know the best you can doing using fields alone is to use { IF "{ INCLUDETEXT "thepathname" }" = ""Error! Not a valid filename." "static text line" "{ INCLUDETEXT "thepathname" }" but then you will see a message box every time the file does not exist, and I do not think you can suppress those messages (easily, anyway). If you are using Word 2002/2003 you could use the mailmerge events to work out the filename and check its existence, then either insert an INCLUDETEXT, insert the file itself, or insert the static text line depending on the result. Peter Jamieson "GeeBee" wrote in message ... Hi! I'm trying to perform a merge in Word and pull in another document if the document exists and if not include a static text line. My problem is that I can't figure out a way to determine if the document is available. Is there any way in Word to see if a document is there before it pulls it into another document with the INCLUDETEXT field? Thank you so much in advance! |
#4
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Using INCLUDETEXT with a file that's not there.
Hi Peter,
You had a couple of superfluous quote marks in there, and one errant one. To use the code with a MERGEFIELD, try: {IF{INCLUDETEXT {MERGEFIELD MyFilePath&Name}} = "Error! Not a valid filename." "static text line" {INCLUDETEXT {MERGEFIELD MyFilePath&Name}} Cheers "Peter Jamieson" wrote in message ... As far as I know the best you can doing using fields alone is to use { IF "{ INCLUDETEXT "thepathname" }" = ""Error! Not a valid filename." "static text line" "{ INCLUDETEXT "thepathname" }" but then you will see a message box every time the file does not exist, and I do not think you can suppress those messages (easily, anyway). If you are using Word 2002/2003 you could use the mailmerge events to work out the filename and check its existence, then either insert an INCLUDETEXT, insert the file itself, or insert the static text line depending on the result. Peter Jamieson "GeeBee" wrote in message ... Hi! I'm trying to perform a merge in Word and pull in another document if the document exists and if not include a static text line. My problem is that I can't figure out a way to determine if the document is available. Is there any way in Word to see if a document is there before it pulls it into another document with the INCLUDETEXT field? Thank you so much in advance! |
#5
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Using INCLUDETEXT with a file that's not there.
Thanks macropod.
On the subject of the superfluous quotes, I prefer to put quotes round (text) comparands and results partly because there seem to be some anomalies in this area, and I think it's a good defensive programming practice since using quotes never seems to cause a problem, and partly because, in the absence of any formal specification of the "field language" I tend to view the Help as the nearest thing to a specification, and it says For the comparands: "If an expression contains spaces, enclose the expression in quotation marks." For the result texts: "Each string containing multiple words must be enclosed in quotation marks. " Precisely what they mean by an expression in this situation is unclear, but I defensively assume they might mean the result of a field as well as the literal text+fields that constitute a comparand. For example, it may be contrived, but try { SET X "1+1" } { IF { X } = "2" "A" "B" } { IF "{ X }" = "2" "A" "B" } Peter Jamieson "macropod" wrote in message ... Hi Peter, You had a couple of superfluous quote marks in there, and one errant one. To use the code with a MERGEFIELD, try: {IF{INCLUDETEXT {MERGEFIELD MyFilePath&Name}} = "Error! Not a valid filename." "static text line" {INCLUDETEXT {MERGEFIELD MyFilePath&Name}} Cheers "Peter Jamieson" wrote in message ... As far as I know the best you can doing using fields alone is to use { IF "{ INCLUDETEXT "thepathname" }" = ""Error! Not a valid filename." "static text line" "{ INCLUDETEXT "thepathname" }" but then you will see a message box every time the file does not exist, and I do not think you can suppress those messages (easily, anyway). If you are using Word 2002/2003 you could use the mailmerge events to work out the filename and check its existence, then either insert an INCLUDETEXT, insert the file itself, or insert the static text line depending on the result. Peter Jamieson "GeeBee" wrote in message ... Hi! I'm trying to perform a merge in Word and pull in another document if the document exists and if not include a static text line. My problem is that I can't figure out a way to determine if the document is available. Is there any way in Word to see if a document is there before it pulls it into another document with the INCLUDETEXT field? Thank you so much in advance! |
#6
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Conditional Mail merge
Word 2003 I am trying to include an autosignature while doing a mail merge. I
This is the format {IF {MERGEFIELD Amount} 250 {INCLUDETEXT WSIGN.DOC \*MERGEFORMAT}" "" When I merge my letters it should put the automatic signature on every letter but what I am getting is Error! Not a valid filename. I tried putting in the pathname but not working. So can you tell me the correct format for getting the result I want. Your help is really needed I have working on the problem for about 3 weeks not getting nowhere not to many people now about conditonal mail merge. Thanks in advance Lynn |
#7
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Conditional Mail merge
Try
a. inserting the complete path to your .doc file, surrounded by quotes, and with tthe backslashes doubled up - e.g. I would start with { IF {MERGEFIELD Amount } 250 "{ INCLUDETEXT "c:\\mypath\\WSIGN.DOC \*MERGEFORMAT}" "" } b. doing the IF field the other way around, to solve a problem with INCLUDETEXT fields inside IF fields { INCLUDETEXT "{ IF { MERGEFIELD Amount } 250 } "c:\\mypath\\wsign.doc" "c:\\mypath\\empty.doc" }" } (you'll need an empty .doc called empty.doc) or bookmark your signature with a bookmark, e.g. "mysig", and bookmark an empty space using e.g. "nosig", then use { INCLUDETEXT "c:\\mypath\\wsign.doc" ""{ IF { MERGEFIELD Amount } 250 } "mysig" "nosig" }" } You may also be able to use AUTOTEXT fields to do the same thing. Peter Jamieson "lynnjohn" wrote in message ... Word 2003 I am trying to include an autosignature while doing a mail merge. I This is the format {IF {MERGEFIELD Amount} 250 {INCLUDETEXT WSIGN.DOC \*MERGEFORMAT}" "" When I merge my letters it should put the automatic signature on every letter but what I am getting is Error! Not a valid filename. I tried putting in the pathname but not working. So can you tell me the correct format for getting the result I want. Your help is really needed I have working on the problem for about 3 weeks not getting nowhere not to many people now about conditonal mail merge. Thanks in advance Lynn |
#8
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Conditional Mail merge
"lynnjohn" wrote: Word 2003 I am trying to include an autosignature while doing a mail merge. I This is the format {IF {MERGEFIELD Amount} 250 {INCLUDETEXT WSIGN.DOC \*MERGEFORMAT}" "" When I merge my letters it should put the automatic signature on every letter but what I am getting is Error! Not a valid filename. I tried putting in the pathname but not working. So can you tell me the correct format for getting the result I want. Your help is really needed I have working on the problem for about 3 weeks not getting nowhere not to many people now about conditonal mail merge. Thanks in advance Lynn |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Insert source texts into multiple files and update automatically | Microsoft Word Help | |||
File Search Preview Pane | Microsoft Word Help | |||
Setting the default encoding...? | Microsoft Word Help | |||
How to create relative and shorthand file path names | Microsoft Word Help | |||
IncludeText gives Error! Not a valid filename on 'refresh' | Formatting Long Documents |