Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / August 2006

Tip: Looking for answers? Try searching our database.

Using INCLUDETEXT with a file that's not there.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GeeBee - 15 Mar 2006 17:49 GMT
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!
Peter Jamieson - 15 Mar 2006 19:08 GMT
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
> Hi!
>  I'm trying to perform a merge in Word and pull in another document if the
[quoted text clipped - 6 lines]
>
> Thank you so much in advance!
GeeBee - 15 Mar 2006 20:41 GMT
Thank you so much! In the document format that I'm using, the error message
won't be a problem. Thank you again!

> As far as I know the best you can doing using fields alone is to use
>
[quoted text clipped - 22 lines]
> >
> > Thank you so much in advance!
macropod - 16 Mar 2006 10:36 GMT
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

> As far as I know the best you can doing using fields alone is to use
>
[quoted text clipped - 22 lines]
> >
> > Thank you so much in advance!
Peter Jamieson - 16 Mar 2006 11:39 GMT
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

> Hi Peter,
>
[quoted text clipped - 39 lines]
>> >
>> > Thank you so much in advance!
lynnjohn - 24 Aug 2006 20:13 GMT
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
Peter Jamieson - 24 Aug 2006 20:30 GMT
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

> Word 2003 I am trying to include an autosignature while doing a mail
> merge. I
[quoted text clipped - 11 lines]
> many
> people now about conditonal mail merge.  Thanks in advance Lynn
lynnjohn - 24 Aug 2006 20:53 GMT
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

> Try
>  a. inserting the complete path to your .doc file, surrounded by quotes, and
[quoted text clipped - 35 lines]
> > many
> > people now about conditonal mail merge.  Thanks in advance Lynn
Doug Robbins - Word MVP - 24 Aug 2006 21:13 GMT
What is Word Mail Wizard?

Try what I suggested in your other post to try and overcome the bold and
centering problem.

Signature

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

>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
[quoted text clipped - 50 lines]
>> > many
>> > people now about conditonal mail merge.  Thanks in advance Lynn
Peter Jamieson - 24 Aug 2006 21:27 GMT
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

>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
[quoted text clipped - 50 lines]
>> > many
>> > people now about conditonal mail merge.  Thanks in advance Lynn
lynnjohn - 24 Aug 2006 20:39 GMT
>  Word 2003 I am trying to include an autosignature while doing a mail merge. I
>
[quoted text clipped - 10 lines]
>
>  

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.