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 |
#9
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Conditional Mail merge
I just did the "a" step and got the same error message I forgot to mention
that I am using Word Mail Wizard to do this merge. Maybe the format is different from the regular word 2003 because it run okay and add the autosignature to the letters. Are you familiar with word mail wizard. The reason why I am using word mail wizard because I couldn't get word 2003 to keep the format of bold and center when merging it would remove bold and align title to left. Word Mail Wizard keep the format but won't add autosignature. Any suggestion on how to keep format while merging. Thanks, for your quck respond. lynnjohn "Peter Jamieson" wrote: 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 |
#10
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Conditional Mail merge
What is Word Mail Wizard?
Try what I suggested in your other post to try and overcome the bold and centering problem. -- 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 "lynnjohn" wrote in message ... I just did the "a" step and got the same error message I forgot to mention that I am using Word Mail Wizard to do this merge. Maybe the format is different from the regular word 2003 because it run okay and add the autosignature to the letters. Are you familiar with word mail wizard. The reason why I am using word mail wizard because I couldn't get word 2003 to keep the format of bold and center when merging it would remove bold and align title to left. Word Mail Wizard keep the format but won't add autosignature. Any suggestion on how to keep format while merging. Thanks, for your quck respond. lynnjohn "Peter Jamieson" wrote: 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 |
#11
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Conditional Mail merge
If you want to make it work, move beyond "wizards" etc. - like "gurus", as
long as they know the one thing you needed to know but didn't, they can be useful useful, but after that they can often get in the way. Useful tools are a. looking at your fields using Alt-F9 b. testing your fields using select, then F9, the Alt-F9 if necessary to see the results c. checking, e.g. to make sure the syntax of your fields is completely correct, e.g. no spaces that should not be there and so on. So, e.g. with you mail merge main document open, use Alt-F9 to look at the underlying field codes. What do you see? With includetext, the problem is sometimes that there is a space before the file name, e.g. you might have { INCLUDETEXT " c:\\abc\\def.doc" } when you need { INCLUDETEXT "c:\\abc\\def.doc" } Peter Jamieson "lynnjohn" wrote in message ... I just did the "a" step and got the same error message I forgot to mention that I am using Word Mail Wizard to do this merge. Maybe the format is different from the regular word 2003 because it run okay and add the autosignature to the letters. Are you familiar with word mail wizard. The reason why I am using word mail wizard because I couldn't get word 2003 to keep the format of bold and center when merging it would remove bold and align title to left. Word Mail Wizard keep the format but won't add autosignature. Any suggestion on how to keep format while merging. Thanks, for your quck respond. lynnjohn "Peter Jamieson" wrote: 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 |
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 |