Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
GeeBee
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
GeeBee
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
lynnjohn lynnjohn is offline
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
lynnjohn lynnjohn is offline
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
lynnjohn lynnjohn is offline
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert source texts into multiple files and update automatically robfer Microsoft Word Help 9 September 12th 07 10:10 PM
File Search Preview Pane ndolinger Microsoft Word Help 2 August 10th 05 04:12 PM
Setting the default encoding...? Kenneth Microsoft Word Help 19 June 20th 05 06:52 PM
How to create relative and shorthand file path names 2dogs Microsoft Word Help 4 May 14th 05 08:49 PM
IncludeText gives Error! Not a valid filename on 'refresh' Lynn Allan Formatting Long Documents 2 March 9th 05 04:10 AM


All times are GMT +1. The time now is 01:34 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"