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 / May 2006

Tip: Looking for answers? Try searching our database.

Can one different files in an "If then... else" WORD merge?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eric_G - 01 May 2006 19:39 GMT
I am attempting to perform a merge where one field indicates "Language".  
Where the language field is "E", I want to use one WORD .doc file and where
the language is "F", I want to invoke a different WORD .doc file.  Can I do
this within a WORD merge using the 'IF... THEN ELSE" merge codes or if not,
is there a better way?
Peter Jamieson - 01 May 2006 20:00 GMT
In theory you ought to be able to do

{ IF "{ MERGEFIELD Language }" = "E" "{ INCLUDETEXT
"c:\\mydocs\\myfilleE.doc" ""
}{ IF "{ MERGEFIELD Language }" = "F" "{ INCLUDETEXT
"c:\\mydocs\\myfilleF.doc" ""
}

but in practice you may have to use something more like

{ INCLUDETEXT "c:\\mydocs\\myfile{ MERGEFIELD Language }.doc" }

and deal with the situation where Language is not "E" or "F", e.g. have
another file called myfile.doc and use

{ INCLUDETEXT "c:\\mydocs\\myfile{ IF "{ MERGEFIELD Language \*Upper }" =
"E" "E" "{ IF "{ MERGEFIELD Language \*Upper }" = "F" "F" "" } } }

etc.

Peter Jamieson
>I am attempting to perform a merge where one field indicates "Language".
> Where the language field is "E", I want to use one WORD .doc file and
[quoted text clipped - 4 lines]
> not,
> is there a better way?
Eric_G - 01 May 2006 20:21 GMT
Unfortunately, the "includetext" command didn't work.  While the main
document isn't too large, I have separate the text into two separate files.  
I even tried the same logic but using the 'HYPERLINK' command as opposed to
INCLUDETEXT but it also didn't work.....

> In theory you ought to be able to do
>
[quoted text clipped - 25 lines]
> > not,
> > is there a better way?
Peter Jamieson - 01 May 2006 20:32 GMT
I missed some characters on this one (although I don't think it will work
anyway...

{ IF "{ MERGEFIELD Language }" = "E" "{ INCLUDETEXT
"c:\\mydocs\\myfilleE.doc" }" ""
}{ IF "{ MERGEFIELD Language }" = "F" "{ INCLUDETEXT
"c:\\mydocs\\myfilleF.doc" }" "" }

But what happens when you try

{ INCLUDETEXT "c:\\mydocs\\myfile{ MERGEFIELD Language }.doc" }

? In all cases, all the {} eed to be the special field code braces you can
insert using ctrl-F9.

HYPERLINK only generates a hypertext link - it doesn't actually include
anything

Peter Jamieson
> Unfortunately, the "includetext" command didn't work.  While the main
> document isn't too large, I have separate the text into two separate
[quoted text clipped - 33 lines]
>> > not,
>> > is there a better way?
Eric_G - 01 May 2006 20:57 GMT
When one tries the latter method, the "filename not found" response appears
-- which makes sense as I don't believe one can have a mergefield within a
mergefield.

The problem with the INCLUDETEXT command is that the main document I am
using also has a few graphic images in it and so INCLUDE TEXT doesn't appear
to pick up the images?

I would have thought there was some way to pick up an entire file within the
IF merge?

> I missed some characters on this one (although I don't think it will work
> anyway...
[quoted text clipped - 52 lines]
> >> > not,
> >> > is there a better way?
Peter Jamieson - 01 May 2006 21:46 GMT
You certainly can nest one field inside another - one thing you can check is
to turn on the merge preview, then use Alt-F9 to display the full code of
the INCLUDETEXT field, then select the nested MERGEFIELD field, right click,
and select Toggle Field codes. You should then be able to see the full path
name of the file that the INCLUDETEXT is trying to include. I would check
that all the backslashes are doubled up (i.e. use c:\\xyz\\abc.doc insted of
c:\xyz\abc.doc) and that there aren't any extra spaces in the path name
(they are rather easy to insert accidentally).

You may also need to uncheck Word Tools|Options|General|Web
options|Files|Update links on save.

> The problem with the INCLUDETEXT command is that the main document I am
> using also has a few graphic images in it and so INCLUDE TEXT doesn't
> appear
> to pick up the images?

It should do, but can you confirm that it is the included document that
contains the images, not the "mail merge main document", i.e. the one that
is attached to the data source and contains the images. Assuming that it is
the included document that contains the images, try the simple case where
you open a new blank document and use Insert|File to insert the whole
docuument, clicking the dropdown on the Insert button and selecting Insert
as link.That should insert an Includetext field, and you should be able to
select it, press F9 to update it, and still see the images. I've just done
it here. But if you don't see the images, there could be a memory problem or
some such.

Peter Jamieson

> When one tries the latter method, the "filename not found" response
> appears
[quoted text clipped - 74 lines]
>> >> > not,
>> >> > is there a better way?
Eric_G - 02 May 2006 17:51 GMT
Peter,
Many thanks.  After much work, the merge does work.  I found that I needed
to set the margins of the master document as the same as the underlying
"include text" WORD documents and remove the switches.

Thanks for your assistance.

> You certainly can nest one field inside another - one thing you can check is
> to turn on the merge preview, then use Alt-F9 to display the full code of
[quoted text clipped - 104 lines]
> >> >> > not,
> >> >> > is there a better way?
 
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.