Mergefields, IF statements and section breaks

J

JAnderson

Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement followed by a
next-page section break. Let's pretend that I'm using the merge field
"Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to bears will
become part of my document, otherwise, nothing happens (the false condition
is ""). Likewise, if "Zebra" is the value of the field, then a document
about zebras appears. Under any condition, however, my "regular" document is
always part of the merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific needs, and
works without any problems. However, there becomes a point where inserting
one more "IF" statement will "break" the whole document.

Say I realize that I need to add yet another document about Lions, so I
follow the formatting above and enter this Lion IF statement right after the
zebra IF statement. For some reason, headers, footers and margins (section
break qualities) will not be correct for whatever document I merge, and
sometimes the "next page" section breaks will reorient themselves as
"continuous", thus melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a section
break is within an IF statement, it would later become functional even though
its condition is not met. Would it be more effective if, every time I added
a new IF statement, I re-built the whole document starting with "Bear", then
"Zebra", then "Lion", then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a grander
scale, I do not want to have hundreds of individual documents to use for
merging data; I would prefer to have one 'master' document.)

Thanks in advance,
 
M

macropod

Hi JAnderson,

You'd probably get better results by creating a separate reference document for each scenario, then embedding your MERGEFIELD within
an INCLUDETEXT field pointing to the folder where those documents can be found.

For example, suppose your refrence documents are in the folder C:\My Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an INCLUDETEXT field coded as:
{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do is to create a corresponding reference document for it in the
folder C:\My Documents\Animals.
 
J

JAnderson

Hmm... So could I still use conditional statements with INCLUDETEXT? If my
database record is 'zebra', I only want my zebra document to show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example, inside
my zebra document are mergefields like 'zoo name' 'zoo address' 'zoo city',
etc., which merge from my database. This works inside IF statements, but I
wonder if it would with INCLUDETEXT...

Thanks,

macropod said:
Hi JAnderson,

You'd probably get better results by creating a separate reference document for each scenario, then embedding your MERGEFIELD within
an INCLUDETEXT field pointing to the folder where those documents can be found.

For example, suppose your refrence documents are in the folder C:\My Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an INCLUDETEXT field coded as:
{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do is to create a corresponding reference document for it in the
folder C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement followed by a
next-page section break. Let's pretend that I'm using the merge field
"Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to bears will
become part of my document, otherwise, nothing happens (the false condition
is ""). Likewise, if "Zebra" is the value of the field, then a document
about zebras appears. Under any condition, however, my "regular" document is
always part of the merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific needs, and
works without any problems. However, there becomes a point where inserting
one more "IF" statement will "break" the whole document.

Say I realize that I need to add yet another document about Lions, so I
follow the formatting above and enter this Lion IF statement right after the
zebra IF statement. For some reason, headers, footers and margins (section
break qualities) will not be correct for whatever document I merge, and
sometimes the "next page" section breaks will reorient themselves as
"continuous", thus melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a section
break is within an IF statement, it would later become functional even though
its condition is not met. Would it be more effective if, every time I added
a new IF statement, I re-built the whole document starting with "Bear", then
"Zebra", then "Lion", then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a grander
scale, I do not want to have hundreds of individual documents to use for
merging data; I would prefer to have one 'master' document.)

Thanks in advance,
 
G

Graham Mayor

The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

macropod said:
Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
whole document starting with "Bear", then "Zebra", then "Lion",
then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a
grander scale, I do not want to have hundreds of individual
documents to use for merging data; I would prefer to have one
'master' document.)

Thanks in advance,
 
J

JAnderson

Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


Graham Mayor said:
The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

macropod said:
Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
whole document starting with "Bear", then "Zebra", then "Lion",
then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a
grander scale, I do not want to have hundreds of individual
documents to use for merging data; I would prefer to have one
'master' document.)

Thanks in advance,
 
M

macropod

Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a continuous Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also. Alternatively, if you want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after that, make the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


Graham Mayor said:
The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
whole document starting with "Bear", then "Zebra", then "Lion",
then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a
grander scale, I do not want to have hundreds of individual
documents to use for merging data; I would prefer to have one
'master' document.)

Thanks in advance,
 
J

JAnderson

Ok, we're definitely getting closer - thank you! I did what you suggested by
placing a continuous section break at the beginning of my 'animal' documents,
and placed a section break after my INCLUDETEXT field.

Two problems:

1) Some of my 'animal' documents have multiple section breaks within the
document (separate footers, etc.). I'm not sure how this is affecting the
resulting document.

2) My resulting merged document only retains the correct formatting for the
first page, then reverts to the default formatting of the 'primary/host'
document. Furthermore, all text and headers/footers are shifted partially
off the visible area of the page (these are not unusual documents, just text
and some tables within the printable margins of a page).

I'm encouraged by the results so far; I really want to get to the point
where my INCLUDETEXT field can LITERALLY pull the entire document. All
mergefields within the INCLUDETEXT document are merging correctly, thankfully.

Any ideas why the formatting doesn't 'stick' on these documents? What about
adding a field switch to the INCLUDETEXT field, like *Charformat or something?

macropod said:
Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a continuous Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also. Alternatively, if you want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after that, make the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


Graham Mayor said:
The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JAnderson wrote:
Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
whole document starting with "Bear", then "Zebra", then "Lion",
then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a
grander scale, I do not want to have hundreds of individual
documents to use for merging data; I would prefer to have one
'master' document.)

Thanks in advance,
 
M

macropod

Hi JAnderson,

Provided your:
.. source document (ie the one referenced by the INCLUDETEXT field) starts off with a Section break; and
.. target document (ie your mailmerge main document) has a Section break after the mergefields,
I don't believe the Section breaks in the source document will have any effect on the target document outside of those Section
breaks.

As for the partial shifting, are you sure the source and target documents have the same page formats (eg A4)?

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ok, we're definitely getting closer - thank you! I did what you suggested by
placing a continuous section break at the beginning of my 'animal' documents,
and placed a section break after my INCLUDETEXT field.

Two problems:

1) Some of my 'animal' documents have multiple section breaks within the
document (separate footers, etc.). I'm not sure how this is affecting the
resulting document.

2) My resulting merged document only retains the correct formatting for the
first page, then reverts to the default formatting of the 'primary/host'
document. Furthermore, all text and headers/footers are shifted partially
off the visible area of the page (these are not unusual documents, just text
and some tables within the printable margins of a page).

I'm encouraged by the results so far; I really want to get to the point
where my INCLUDETEXT field can LITERALLY pull the entire document. All
mergefields within the INCLUDETEXT document are merging correctly, thankfully.

Any ideas why the formatting doesn't 'stick' on these documents? What about
adding a field switch to the INCLUDETEXT field, like *Charformat or something?

macropod said:
Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a continuous
Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also. Alternatively, if you
want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after that, make the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


:

The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JAnderson wrote:
Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
whole document starting with "Bear", then "Zebra", then "Lion",
then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a
grander scale, I do not want to have hundreds of individual
documents to use for merging data; I would prefer to have one
'master' document.)

Thanks in advance,
 
J

JAnderson

From what you're describing, what I'm doing should work perfectly, you're
right. The best way I can describe what is going on is that only the first
page of my final product seems to observe the formatting; all remaining pages
revert to the target document's default settings. Furthermore, the text from
the source document does not line up with the indent arrows - instead it
falls off to the left of the page. It's very unusual. The same thing
happens with the header and footer on all pages after the first page.

Do you think I should try a section break at the beginning AND end of the
source documents? I'm SO close, I feel like I'm just missing one step.

Thanks again for all of your help,


macropod said:
Hi JAnderson,

Provided your:
.. source document (ie the one referenced by the INCLUDETEXT field) starts off with a Section break; and
.. target document (ie your mailmerge main document) has a Section break after the mergefields,
I don't believe the Section breaks in the source document will have any effect on the target document outside of those Section
breaks.

As for the partial shifting, are you sure the source and target documents have the same page formats (eg A4)?

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ok, we're definitely getting closer - thank you! I did what you suggested by
placing a continuous section break at the beginning of my 'animal' documents,
and placed a section break after my INCLUDETEXT field.

Two problems:

1) Some of my 'animal' documents have multiple section breaks within the
document (separate footers, etc.). I'm not sure how this is affecting the
resulting document.

2) My resulting merged document only retains the correct formatting for the
first page, then reverts to the default formatting of the 'primary/host'
document. Furthermore, all text and headers/footers are shifted partially
off the visible area of the page (these are not unusual documents, just text
and some tables within the printable margins of a page).

I'm encouraged by the results so far; I really want to get to the point
where my INCLUDETEXT field can LITERALLY pull the entire document. All
mergefields within the INCLUDETEXT document are merging correctly, thankfully.

Any ideas why the formatting doesn't 'stick' on these documents? What about
adding a field switch to the INCLUDETEXT field, like *Charformat or something?

macropod said:
Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a continuous
Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also. Alternatively, if you
want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after that, make the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


:

The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JAnderson wrote:
Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
whole document starting with "Bear", then "Zebra", then "Lion",
then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a
grander scale, I do not want to have hundreds of individual
documents to use for merging data; I would prefer to have one
'master' document.)

Thanks in advance,
 
M

macropod

Hi JAnderson,

The symptoms you're describing suggest the source document has a different paper size than the target document.

As for indents & tabs, are you sure they're defined using the same defaults for both the source and target documents?
Do you think I should try a section break at the beginning AND end of the source documents?
Wouldn't hurt, especially if that Section break reverts the page layout settings to those used in the target document.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
From what you're describing, what I'm doing should work perfectly, you're
right. The best way I can describe what is going on is that only the first
page of my final product seems to observe the formatting; all remaining pages
revert to the target document's default settings. Furthermore, the text from
the source document does not line up with the indent arrows - instead it
falls off to the left of the page. It's very unusual. The same thing
happens with the header and footer on all pages after the first page.

Do you think I should try a section break at the beginning AND end of the
source documents? I'm SO close, I feel like I'm just missing one step.

Thanks again for all of your help,


macropod said:
Hi JAnderson,

Provided your:
.. source document (ie the one referenced by the INCLUDETEXT field) starts off with a Section break; and
.. target document (ie your mailmerge main document) has a Section break after the mergefields,
I don't believe the Section breaks in the source document will have any effect on the target document outside of those Section
breaks.

As for the partial shifting, are you sure the source and target documents have the same page formats (eg A4)?

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ok, we're definitely getting closer - thank you! I did what you suggested by
placing a continuous section break at the beginning of my 'animal' documents,
and placed a section break after my INCLUDETEXT field.

Two problems:

1) Some of my 'animal' documents have multiple section breaks within the
document (separate footers, etc.). I'm not sure how this is affecting the
resulting document.

2) My resulting merged document only retains the correct formatting for the
first page, then reverts to the default formatting of the 'primary/host'
document. Furthermore, all text and headers/footers are shifted partially
off the visible area of the page (these are not unusual documents, just text
and some tables within the printable margins of a page).

I'm encouraged by the results so far; I really want to get to the point
where my INCLUDETEXT field can LITERALLY pull the entire document. All
mergefields within the INCLUDETEXT document are merging correctly, thankfully.

Any ideas why the formatting doesn't 'stick' on these documents? What about
adding a field switch to the INCLUDETEXT field, like *Charformat or something?

:

Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a continuous
Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also. Alternatively, if
you
want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after that, make the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


:

The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JAnderson wrote:
Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
whole document starting with "Bear", then "Zebra", then "Lion",
then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a
grander scale, I do not want to have hundreds of individual
documents to use for merging data; I would prefer to have one
'master' document.)

Thanks in advance,
 
M

macropod

Oh, BTW, I should have mentioned that the 1st Section in the source document should be formatted with the same attributes as the
target document.

--
Cheers
macropod
[MVP - Microsoft Word]


macropod said:
Hi JAnderson,

The symptoms you're describing suggest the source document has a different paper size than the target document.

As for indents & tabs, are you sure they're defined using the same defaults for both the source and target documents?
Do you think I should try a section break at the beginning AND end of the source documents?
Wouldn't hurt, especially if that Section break reverts the page layout settings to those used in the target document.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
From what you're describing, what I'm doing should work perfectly, you're
right. The best way I can describe what is going on is that only the first
page of my final product seems to observe the formatting; all remaining pages
revert to the target document's default settings. Furthermore, the text from
the source document does not line up with the indent arrows - instead it
falls off to the left of the page. It's very unusual. The same thing
happens with the header and footer on all pages after the first page.

Do you think I should try a section break at the beginning AND end of the
source documents? I'm SO close, I feel like I'm just missing one step.

Thanks again for all of your help,


macropod said:
Hi JAnderson,

Provided your:
.. source document (ie the one referenced by the INCLUDETEXT field) starts off with a Section break; and
.. target document (ie your mailmerge main document) has a Section break after the mergefields,
I don't believe the Section breaks in the source document will have any effect on the target document outside of those Section
breaks.

As for the partial shifting, are you sure the source and target documents have the same page formats (eg A4)?

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, we're definitely getting closer - thank you! I did what you suggested by
placing a continuous section break at the beginning of my 'animal' documents,
and placed a section break after my INCLUDETEXT field.

Two problems:

1) Some of my 'animal' documents have multiple section breaks within the
document (separate footers, etc.). I'm not sure how this is affecting the
resulting document.

2) My resulting merged document only retains the correct formatting for the
first page, then reverts to the default formatting of the 'primary/host'
document. Furthermore, all text and headers/footers are shifted partially
off the visible area of the page (these are not unusual documents, just text
and some tables within the printable margins of a page).

I'm encouraged by the results so far; I really want to get to the point
where my INCLUDETEXT field can LITERALLY pull the entire document. All
mergefields within the INCLUDETEXT document are merging correctly, thankfully.

Any ideas why the formatting doesn't 'stick' on these documents? What about
adding a field switch to the INCLUDETEXT field, like *Charformat or something?

:

Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a continuous
Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also. Alternatively, if
you
want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after that, make
the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


:

The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JAnderson wrote:
Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
whole document starting with "Bear", then "Zebra", then "Lion",
then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a
grander scale, I do not want to have hundreds of individual
documents to use for merging data; I would prefer to have one
'master' document.)

Thanks in advance,
 
J

JAnderson

Hmm... That seems problematic. Say my target document has 1" margins and no
header/footer. Then, for example:

Penguin.doc = 0.5" margins, header and footer present
Lions.doc = 0.75" top margin, 0.35" right margin, header present
Zebra.doc = 0.3" margins all around, no header or footer

Resulting merged document = 1" margins, except for page 1.

I was hoping that by setting the INCLUDETEXT field up this way I could just
have one document that would incorporate the formatting characteristics of
all of the source documents, but it seems what you are saying is that is not
possible? I'm not sure how I could even work around this limitation then,
and I thought I was so close. Am I reading this wrong? Thanks,

macropod said:
Oh, BTW, I should have mentioned that the 1st Section in the source document should be formatted with the same attributes as the
target document.

--
Cheers
macropod
[MVP - Microsoft Word]


macropod said:
Hi JAnderson,

The symptoms you're describing suggest the source document has a different paper size than the target document.

As for indents & tabs, are you sure they're defined using the same defaults for both the source and target documents?
Do you think I should try a section break at the beginning AND end of the source documents?
Wouldn't hurt, especially if that Section break reverts the page layout settings to those used in the target document.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
From what you're describing, what I'm doing should work perfectly, you're
right. The best way I can describe what is going on is that only the first
page of my final product seems to observe the formatting; all remaining pages
revert to the target document's default settings. Furthermore, the text from
the source document does not line up with the indent arrows - instead it
falls off to the left of the page. It's very unusual. The same thing
happens with the header and footer on all pages after the first page.

Do you think I should try a section break at the beginning AND end of the
source documents? I'm SO close, I feel like I'm just missing one step.

Thanks again for all of your help,


:

Hi JAnderson,

Provided your:
.. source document (ie the one referenced by the INCLUDETEXT field) starts off with a Section break; and
.. target document (ie your mailmerge main document) has a Section break after the mergefields,
I don't believe the Section breaks in the source document will have any effect on the target document outside of those Section
breaks.

As for the partial shifting, are you sure the source and target documents have the same page formats (eg A4)?

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, we're definitely getting closer - thank you! I did what you suggested by
placing a continuous section break at the beginning of my 'animal' documents,
and placed a section break after my INCLUDETEXT field.

Two problems:

1) Some of my 'animal' documents have multiple section breaks within the
document (separate footers, etc.). I'm not sure how this is affecting the
resulting document.

2) My resulting merged document only retains the correct formatting for the
first page, then reverts to the default formatting of the 'primary/host'
document. Furthermore, all text and headers/footers are shifted partially
off the visible area of the page (these are not unusual documents, just text
and some tables within the printable margins of a page).

I'm encouraged by the results so far; I really want to get to the point
where my INCLUDETEXT field can LITERALLY pull the entire document. All
mergefields within the INCLUDETEXT document are merging correctly, thankfully.

Any ideas why the formatting doesn't 'stick' on these documents? What about
adding a field switch to the INCLUDETEXT field, like *Charformat or something?

:

Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a continuous
Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also. Alternatively, if
you
want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after that, make
the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


:

The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JAnderson wrote:
Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
whole document starting with "Bear", then "Zebra", then "Lion",
then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a
grander scale, I do not want to have hundreds of individual
documents to use for merging data; I would prefer to have one
'master' document.)

Thanks in advance,
 
M

macropod

Hi JAnderson,

OK, the target document requires 1" margins before & after the souce document, but the source documents can have varying margins.

So, for each source document:
.. insert a Section break at the very start of the document.
.. insert a Section break at the very end of the document.
and format the Sections thus created (ie the new Section 1 and the new last Section) with 1" margins, and give the rest of the
source document whatever margins it requires. Also unlink the headers & footers for your new 2nd Section and last Section in to
source document from that document's previous Sections and delete the heading from the new 1st Section.

With this approach, I don't see any need for a Section break to follow the mergfields in your target document.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Hmm... That seems problematic. Say my target document has 1" margins and no
header/footer. Then, for example:

Penguin.doc = 0.5" margins, header and footer present
Lions.doc = 0.75" top margin, 0.35" right margin, header present
Zebra.doc = 0.3" margins all around, no header or footer

Resulting merged document = 1" margins, except for page 1.

I was hoping that by setting the INCLUDETEXT field up this way I could just
have one document that would incorporate the formatting characteristics of
all of the source documents, but it seems what you are saying is that is not
possible? I'm not sure how I could even work around this limitation then,
and I thought I was so close. Am I reading this wrong? Thanks,

macropod said:
Oh, BTW, I should have mentioned that the 1st Section in the source document should be formatted with the same attributes as the
target document.

--
Cheers
macropod
[MVP - Microsoft Word]


macropod said:
Hi JAnderson,

The symptoms you're describing suggest the source document has a different paper size than the target document.

As for indents & tabs, are you sure they're defined using the same defaults for both the source and target documents?

Do you think I should try a section break at the beginning AND end of the source documents?
Wouldn't hurt, especially if that Section break reverts the page layout settings to those used in the target document.

--
Cheers
macropod
[MVP - Microsoft Word]


From what you're describing, what I'm doing should work perfectly, you're
right. The best way I can describe what is going on is that only the first
page of my final product seems to observe the formatting; all remaining pages
revert to the target document's default settings. Furthermore, the text from
the source document does not line up with the indent arrows - instead it
falls off to the left of the page. It's very unusual. The same thing
happens with the header and footer on all pages after the first page.

Do you think I should try a section break at the beginning AND end of the
source documents? I'm SO close, I feel like I'm just missing one step.

Thanks again for all of your help,


:

Hi JAnderson,

Provided your:
.. source document (ie the one referenced by the INCLUDETEXT field) starts off with a Section break; and
.. target document (ie your mailmerge main document) has a Section break after the mergefields,
I don't believe the Section breaks in the source document will have any effect on the target document outside of those
Section
breaks.

As for the partial shifting, are you sure the source and target documents have the same page formats (eg A4)?

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, we're definitely getting closer - thank you! I did what you suggested by
placing a continuous section break at the beginning of my 'animal' documents,
and placed a section break after my INCLUDETEXT field.

Two problems:

1) Some of my 'animal' documents have multiple section breaks within the
document (separate footers, etc.). I'm not sure how this is affecting the
resulting document.

2) My resulting merged document only retains the correct formatting for the
first page, then reverts to the default formatting of the 'primary/host'
document. Furthermore, all text and headers/footers are shifted partially
off the visible area of the page (these are not unusual documents, just text
and some tables within the printable margins of a page).

I'm encouraged by the results so far; I really want to get to the point
where my INCLUDETEXT field can LITERALLY pull the entire document. All
mergefields within the INCLUDETEXT document are merging correctly, thankfully.

Any ideas why the formatting doesn't 'stick' on these documents? What about
adding a field switch to the INCLUDETEXT field, like *Charformat or something?

:

Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a continuous
Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also. Alternatively,
if
you
want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after that, make
the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


:

The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JAnderson wrote:
Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
whole document starting with "Bear", then "Zebra", then "Lion",
then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a
grander scale, I do not want to have hundreds of individual
documents to use for merging data; I would prefer to have one
'master' document.)

Thanks in advance,
 
J

JAnderson

Ah, now I understand where the miscommunication is. My objective is to have
the target margin adopt whatever margins the source document has. In
essence, I want my target document to "become" the source document. Thus, if
I merge in the "Zebra" document with its 0.3" margins, I want my final
product to have 0.3" margins. My current problem is that my current setup
causes the target document to have 0.3" margins only on the first page, and
the rest reverts back to the default of the target document, with text
shifted aside.

I will try adding section breaks at the beginning and end of the source
documents, but I'm curious if you have any additional suggestion now that I
have a better idea what I'm talking about :)

Thanks so much for your help,

macropod said:
Hi JAnderson,

OK, the target document requires 1" margins before & after the souce document, but the source documents can have varying margins.

So, for each source document:
.. insert a Section break at the very start of the document.
.. insert a Section break at the very end of the document.
and format the Sections thus created (ie the new Section 1 and the new last Section) with 1" margins, and give the rest of the
source document whatever margins it requires. Also unlink the headers & footers for your new 2nd Section and last Section in to
source document from that document's previous Sections and delete the heading from the new 1st Section.

With this approach, I don't see any need for a Section break to follow the mergfields in your target document.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Hmm... That seems problematic. Say my target document has 1" margins and no
header/footer. Then, for example:

Penguin.doc = 0.5" margins, header and footer present
Lions.doc = 0.75" top margin, 0.35" right margin, header present
Zebra.doc = 0.3" margins all around, no header or footer

Resulting merged document = 1" margins, except for page 1.

I was hoping that by setting the INCLUDETEXT field up this way I could just
have one document that would incorporate the formatting characteristics of
all of the source documents, but it seems what you are saying is that is not
possible? I'm not sure how I could even work around this limitation then,
and I thought I was so close. Am I reading this wrong? Thanks,

macropod said:
Oh, BTW, I should have mentioned that the 1st Section in the source document should be formatted with the same attributes as the
target document.

--
Cheers
macropod
[MVP - Microsoft Word]


Hi JAnderson,

The symptoms you're describing suggest the source document has a different paper size than the target document.

As for indents & tabs, are you sure they're defined using the same defaults for both the source and target documents?

Do you think I should try a section break at the beginning AND end of the source documents?
Wouldn't hurt, especially if that Section break reverts the page layout settings to those used in the target document.

--
Cheers
macropod
[MVP - Microsoft Word]


From what you're describing, what I'm doing should work perfectly, you're
right. The best way I can describe what is going on is that only the first
page of my final product seems to observe the formatting; all remaining pages
revert to the target document's default settings. Furthermore, the text from
the source document does not line up with the indent arrows - instead it
falls off to the left of the page. It's very unusual. The same thing
happens with the header and footer on all pages after the first page.

Do you think I should try a section break at the beginning AND end of the
source documents? I'm SO close, I feel like I'm just missing one step.

Thanks again for all of your help,


:

Hi JAnderson,

Provided your:
.. source document (ie the one referenced by the INCLUDETEXT field) starts off with a Section break; and
.. target document (ie your mailmerge main document) has a Section break after the mergefields,
I don't believe the Section breaks in the source document will have any effect on the target document outside of those
Section
breaks.

As for the partial shifting, are you sure the source and target documents have the same page formats (eg A4)?

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, we're definitely getting closer - thank you! I did what you suggested by
placing a continuous section break at the beginning of my 'animal' documents,
and placed a section break after my INCLUDETEXT field.

Two problems:

1) Some of my 'animal' documents have multiple section breaks within the
document (separate footers, etc.). I'm not sure how this is affecting the
resulting document.

2) My resulting merged document only retains the correct formatting for the
first page, then reverts to the default formatting of the 'primary/host'
document. Furthermore, all text and headers/footers are shifted partially
off the visible area of the page (these are not unusual documents, just text
and some tables within the printable margins of a page).

I'm encouraged by the results so far; I really want to get to the point
where my INCLUDETEXT field can LITERALLY pull the entire document. All
mergefields within the INCLUDETEXT document are merging correctly, thankfully.

Any ideas why the formatting doesn't 'stick' on these documents? What about
adding a field switch to the INCLUDETEXT field, like *Charformat or something?

:

Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a continuous
Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also. Alternatively,
if
you
want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after that, make
the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


:

The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JAnderson wrote:
Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
whole document starting with "Bear", then "Zebra", then "Lion",
then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a
grander scale, I do not want to have hundreds of individual
documents to use for merging data; I would prefer to have one
'master' document.)

Thanks in advance,
 
M

macropod

Hi JAnderson,

OK, that's easy enough:

With your source document, you can omit the last Section break I referred to. Now, format the 1st Section with your desired source
document layout. Next, select that Section break and bookmark it (Insert|Bookmark). I'll assume you called it 'Layout'

Now, go to the very start of your target document, and insert an INCLUDTEXT/MERGEFIELD combination, coded along the lines of:
{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc" Layout}

That's all you need to force the target document to adopt the source document's layout.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ah, now I understand where the miscommunication is. My objective is to have
the target margin adopt whatever margins the source document has. In
essence, I want my target document to "become" the source document. Thus, if
I merge in the "Zebra" document with its 0.3" margins, I want my final
product to have 0.3" margins. My current problem is that my current setup
causes the target document to have 0.3" margins only on the first page, and
the rest reverts back to the default of the target document, with text
shifted aside.

I will try adding section breaks at the beginning and end of the source
documents, but I'm curious if you have any additional suggestion now that I
have a better idea what I'm talking about :)

Thanks so much for your help,

macropod said:
Hi JAnderson,

OK, the target document requires 1" margins before & after the souce document, but the source documents can have varying margins.

So, for each source document:
.. insert a Section break at the very start of the document.
.. insert a Section break at the very end of the document.
and format the Sections thus created (ie the new Section 1 and the new last Section) with 1" margins, and give the rest of the
source document whatever margins it requires. Also unlink the headers & footers for your new 2nd Section and last Section in to
source document from that document's previous Sections and delete the heading from the new 1st Section.

With this approach, I don't see any need for a Section break to follow the mergfields in your target document.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Hmm... That seems problematic. Say my target document has 1" margins and no
header/footer. Then, for example:

Penguin.doc = 0.5" margins, header and footer present
Lions.doc = 0.75" top margin, 0.35" right margin, header present
Zebra.doc = 0.3" margins all around, no header or footer

Resulting merged document = 1" margins, except for page 1.

I was hoping that by setting the INCLUDETEXT field up this way I could just
have one document that would incorporate the formatting characteristics of
all of the source documents, but it seems what you are saying is that is not
possible? I'm not sure how I could even work around this limitation then,
and I thought I was so close. Am I reading this wrong? Thanks,

:

Oh, BTW, I should have mentioned that the 1st Section in the source document should be formatted with the same attributes as
the
target document.

--
Cheers
macropod
[MVP - Microsoft Word]


Hi JAnderson,

The symptoms you're describing suggest the source document has a different paper size than the target document.

As for indents & tabs, are you sure they're defined using the same defaults for both the source and target documents?

Do you think I should try a section break at the beginning AND end of the source documents?
Wouldn't hurt, especially if that Section break reverts the page layout settings to those used in the target document.

--
Cheers
macropod
[MVP - Microsoft Word]


From what you're describing, what I'm doing should work perfectly, you're
right. The best way I can describe what is going on is that only the first
page of my final product seems to observe the formatting; all remaining pages
revert to the target document's default settings. Furthermore, the text from
the source document does not line up with the indent arrows - instead it
falls off to the left of the page. It's very unusual. The same thing
happens with the header and footer on all pages after the first page.

Do you think I should try a section break at the beginning AND end of the
source documents? I'm SO close, I feel like I'm just missing one step.

Thanks again for all of your help,


:

Hi JAnderson,

Provided your:
.. source document (ie the one referenced by the INCLUDETEXT field) starts off with a Section break; and
.. target document (ie your mailmerge main document) has a Section break after the mergefields,
I don't believe the Section breaks in the source document will have any effect on the target document outside of those
Section
breaks.

As for the partial shifting, are you sure the source and target documents have the same page formats (eg A4)?

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, we're definitely getting closer - thank you! I did what you suggested by
placing a continuous section break at the beginning of my 'animal' documents,
and placed a section break after my INCLUDETEXT field.

Two problems:

1) Some of my 'animal' documents have multiple section breaks within the
document (separate footers, etc.). I'm not sure how this is affecting the
resulting document.

2) My resulting merged document only retains the correct formatting for the
first page, then reverts to the default formatting of the 'primary/host'
document. Furthermore, all text and headers/footers are shifted partially
off the visible area of the page (these are not unusual documents, just text
and some tables within the printable margins of a page).

I'm encouraged by the results so far; I really want to get to the point
where my INCLUDETEXT field can LITERALLY pull the entire document. All
mergefields within the INCLUDETEXT document are merging correctly, thankfully.

Any ideas why the formatting doesn't 'stick' on these documents? What about
adding a field switch to the INCLUDETEXT field, like *Charformat or something?

:

Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a
continuous
Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also.
Alternatively,
if
you
want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after that,
make
the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


:

The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JAnderson wrote:
Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
whole document starting with "Bear", then "Zebra", then "Lion",
then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a
grander scale, I do not want to have hundreds of individual
documents to use for merging data; I would prefer to have one
'master' document.)

Thanks in advance,
 
R

RoboNix

Hello,

I've been following this thread with some interest; it appears I'm
attempting to do almost the exact same thing as JAnderson. Similarly, I'm
having difficulty getting the margins of the target document to adjust to
those of the source document upon merging.

If I'm following this correctly, my target document contains the following
link:

{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc" Layout}

and I've created a bookmark in a section break in the source document called
"Layout". My difficulty is when the merge is completed, I'm getting the
header and footer from the source document, but none of the body of the text.

The only section break I have in the source document is a continuous one at
the end of the document; this is the one I've bookmarked. Any insight as to
why I might only be getting the header and footer? The good news is the
margins appear to be correct in the target document!

This thread has been wonderful in providing insight into a subject that has
repeatedly caused me considerable confusion; many thanks to both of you for
your posts.

macropod said:
Hi JAnderson,

OK, that's easy enough:

With your source document, you can omit the last Section break I referred to. Now, format the 1st Section with your desired source
document layout. Next, select that Section break and bookmark it (Insert|Bookmark). I'll assume you called it 'Layout'

Now, go to the very start of your target document, and insert an INCLUDTEXT/MERGEFIELD combination, coded along the lines of:
{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc" Layout}

That's all you need to force the target document to adopt the source document's layout.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ah, now I understand where the miscommunication is. My objective is to have
the target margin adopt whatever margins the source document has. In
essence, I want my target document to "become" the source document. Thus, if
I merge in the "Zebra" document with its 0.3" margins, I want my final
product to have 0.3" margins. My current problem is that my current setup
causes the target document to have 0.3" margins only on the first page, and
the rest reverts back to the default of the target document, with text
shifted aside.

I will try adding section breaks at the beginning and end of the source
documents, but I'm curious if you have any additional suggestion now that I
have a better idea what I'm talking about :)

Thanks so much for your help,

macropod said:
Hi JAnderson,

OK, the target document requires 1" margins before & after the souce document, but the source documents can have varying margins.

So, for each source document:
.. insert a Section break at the very start of the document.
.. insert a Section break at the very end of the document.
and format the Sections thus created (ie the new Section 1 and the new last Section) with 1" margins, and give the rest of the
source document whatever margins it requires. Also unlink the headers & footers for your new 2nd Section and last Section in to
source document from that document's previous Sections and delete the heading from the new 1st Section.

With this approach, I don't see any need for a Section break to follow the mergfields in your target document.

--
Cheers
macropod
[MVP - Microsoft Word]


Hmm... That seems problematic. Say my target document has 1" margins and no
header/footer. Then, for example:

Penguin.doc = 0.5" margins, header and footer present
Lions.doc = 0.75" top margin, 0.35" right margin, header present
Zebra.doc = 0.3" margins all around, no header or footer

Resulting merged document = 1" margins, except for page 1.

I was hoping that by setting the INCLUDETEXT field up this way I could just
have one document that would incorporate the formatting characteristics of
all of the source documents, but it seems what you are saying is that is not
possible? I'm not sure how I could even work around this limitation then,
and I thought I was so close. Am I reading this wrong? Thanks,

:

Oh, BTW, I should have mentioned that the 1st Section in the source document should be formatted with the same attributes as
the
target document.

--
Cheers
macropod
[MVP - Microsoft Word]


Hi JAnderson,

The symptoms you're describing suggest the source document has a different paper size than the target document.

As for indents & tabs, are you sure they're defined using the same defaults for both the source and target documents?

Do you think I should try a section break at the beginning AND end of the source documents?
Wouldn't hurt, especially if that Section break reverts the page layout settings to those used in the target document.

--
Cheers
macropod
[MVP - Microsoft Word]


From what you're describing, what I'm doing should work perfectly, you're
right. The best way I can describe what is going on is that only the first
page of my final product seems to observe the formatting; all remaining pages
revert to the target document's default settings. Furthermore, the text from
the source document does not line up with the indent arrows - instead it
falls off to the left of the page. It's very unusual. The same thing
happens with the header and footer on all pages after the first page.

Do you think I should try a section break at the beginning AND end of the
source documents? I'm SO close, I feel like I'm just missing one step.

Thanks again for all of your help,


:

Hi JAnderson,

Provided your:
.. source document (ie the one referenced by the INCLUDETEXT field) starts off with a Section break; and
.. target document (ie your mailmerge main document) has a Section break after the mergefields,
I don't believe the Section breaks in the source document will have any effect on the target document outside of those
Section
breaks.

As for the partial shifting, are you sure the source and target documents have the same page formats (eg A4)?

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, we're definitely getting closer - thank you! I did what you suggested by
placing a continuous section break at the beginning of my 'animal' documents,
and placed a section break after my INCLUDETEXT field.

Two problems:

1) Some of my 'animal' documents have multiple section breaks within the
document (separate footers, etc.). I'm not sure how this is affecting the
resulting document.

2) My resulting merged document only retains the correct formatting for the
first page, then reverts to the default formatting of the 'primary/host'
document. Furthermore, all text and headers/footers are shifted partially
off the visible area of the page (these are not unusual documents, just text
and some tables within the printable margins of a page).

I'm encouraged by the results so far; I really want to get to the point
where my INCLUDETEXT field can LITERALLY pull the entire document. All
mergefields within the INCLUDETEXT document are merging correctly, thankfully.

Any ideas why the formatting doesn't 'stick' on these documents? What about
adding a field switch to the INCLUDETEXT field, like *Charformat or something?

:

Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a
continuous
Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also.
Alternatively,
if
you
want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after that,
make
the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


:

The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JAnderson wrote:
Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
 
M

macropod

Hi JAnderson,

For error handling, you can use code like:
{IF{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}= "Error!*" "" {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}}
The IF test examines the INCLUDETEXT result and, if it starts with 'Error!' (which I assume your 'Animal.doc' won't), then the
INCLUDETEXT result is suppressed but you'll still get the body of the target document.

If you want to supress the target document too, you could use a SKIPIF field, as in:
{SKIPIF{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}= "Error!*"}

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
I think I understand, using a slightly different methodology (no bookmarks).
But before I get there, I need some error handling.

Let's say my mergefield is "Panda", but for whatever reason, I don't have
any "Panda.doc", and I don't intend to have one. How can I use my
INCLUDETEXT field to return nothing at all if the document doesn't exist?
Currently, I get an error.

Your help has been invaluable on this. Thanks,

macropod said:
Hi JAnderson,

OK, that's easy enough:

With your source document, you can omit the last Section break I referred to. Now, format the 1st Section with your desired
source
document layout. Next, select that Section break and bookmark it (Insert|Bookmark). I'll assume you called it 'Layout'

Now, go to the very start of your target document, and insert an INCLUDTEXT/MERGEFIELD combination, coded along the lines of:
{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc" Layout}

That's all you need to force the target document to adopt the source document's layout.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ah, now I understand where the miscommunication is. My objective is to have
the target margin adopt whatever margins the source document has. In
essence, I want my target document to "become" the source document. Thus, if
I merge in the "Zebra" document with its 0.3" margins, I want my final
product to have 0.3" margins. My current problem is that my current setup
causes the target document to have 0.3" margins only on the first page, and
the rest reverts back to the default of the target document, with text
shifted aside.

I will try adding section breaks at the beginning and end of the source
documents, but I'm curious if you have any additional suggestion now that I
have a better idea what I'm talking about :)

Thanks so much for your help,

:

Hi JAnderson,

OK, the target document requires 1" margins before & after the souce document, but the source documents can have varying
margins.

So, for each source document:
.. insert a Section break at the very start of the document.
.. insert a Section break at the very end of the document.
and format the Sections thus created (ie the new Section 1 and the new last Section) with 1" margins, and give the rest of the
source document whatever margins it requires. Also unlink the headers & footers for your new 2nd Section and last Section in
to
source document from that document's previous Sections and delete the heading from the new 1st Section.

With this approach, I don't see any need for a Section break to follow the mergfields in your target document.

--
Cheers
macropod
[MVP - Microsoft Word]


Hmm... That seems problematic. Say my target document has 1" margins and no
header/footer. Then, for example:

Penguin.doc = 0.5" margins, header and footer present
Lions.doc = 0.75" top margin, 0.35" right margin, header present
Zebra.doc = 0.3" margins all around, no header or footer

Resulting merged document = 1" margins, except for page 1.

I was hoping that by setting the INCLUDETEXT field up this way I could just
have one document that would incorporate the formatting characteristics of
all of the source documents, but it seems what you are saying is that is not
possible? I'm not sure how I could even work around this limitation then,
and I thought I was so close. Am I reading this wrong? Thanks,

:

Oh, BTW, I should have mentioned that the 1st Section in the source document should be formatted with the same attributes
as
the
target document.

--
Cheers
macropod
[MVP - Microsoft Word]


Hi JAnderson,

The symptoms you're describing suggest the source document has a different paper size than the target document.

As for indents & tabs, are you sure they're defined using the same defaults for both the source and target documents?

Do you think I should try a section break at the beginning AND end of the source documents?
Wouldn't hurt, especially if that Section break reverts the page layout settings to those used in the target document.

--
Cheers
macropod
[MVP - Microsoft Word]


From what you're describing, what I'm doing should work perfectly, you're
right. The best way I can describe what is going on is that only the first
page of my final product seems to observe the formatting; all remaining pages
revert to the target document's default settings. Furthermore, the text from
the source document does not line up with the indent arrows - instead it
falls off to the left of the page. It's very unusual. The same thing
happens with the header and footer on all pages after the first page.

Do you think I should try a section break at the beginning AND end of the
source documents? I'm SO close, I feel like I'm just missing one step.

Thanks again for all of your help,


:

Hi JAnderson,

Provided your:
.. source document (ie the one referenced by the INCLUDETEXT field) starts off with a Section break; and
.. target document (ie your mailmerge main document) has a Section break after the mergefields,
I don't believe the Section breaks in the source document will have any effect on the target document outside of those
Section
breaks.

As for the partial shifting, are you sure the source and target documents have the same page formats (eg A4)?

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, we're definitely getting closer - thank you! I did what you suggested by
placing a continuous section break at the beginning of my 'animal' documents,
and placed a section break after my INCLUDETEXT field.

Two problems:

1) Some of my 'animal' documents have multiple section breaks within the
document (separate footers, etc.). I'm not sure how this is affecting the
resulting document.

2) My resulting merged document only retains the correct formatting for the
first page, then reverts to the default formatting of the 'primary/host'
document. Furthermore, all text and headers/footers are shifted partially
off the visible area of the page (these are not unusual documents, just text
and some tables within the printable margins of a page).

I'm encouraged by the results so far; I really want to get to the point
where my INCLUDETEXT field can LITERALLY pull the entire document. All
mergefields within the INCLUDETEXT document are merging correctly, thankfully.

Any ideas why the formatting doesn't 'stick' on these documents? What about
adding a field switch to the INCLUDETEXT field, like *Charformat or something?

:

Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a
continuous
Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also.
Alternatively,
if
you
want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after
that,
make
the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


:

The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JAnderson wrote:
Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
 
M

macropod

Hi RoboNix,

The field:
{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc" Layout}
Is only meant to modify the page layout of the target document. To get the rest of the source document, you also need a field coded
as:
{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

--
Cheers
macropod
[MVP - Microsoft Word]


RoboNix said:
Hello,

I've been following this thread with some interest; it appears I'm
attempting to do almost the exact same thing as JAnderson. Similarly, I'm
having difficulty getting the margins of the target document to adjust to
those of the source document upon merging.

If I'm following this correctly, my target document contains the following
link:

{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc" Layout}

and I've created a bookmark in a section break in the source document called
"Layout". My difficulty is when the merge is completed, I'm getting the
header and footer from the source document, but none of the body of the text.

The only section break I have in the source document is a continuous one at
the end of the document; this is the one I've bookmarked. Any insight as to
why I might only be getting the header and footer? The good news is the
margins appear to be correct in the target document!

This thread has been wonderful in providing insight into a subject that has
repeatedly caused me considerable confusion; many thanks to both of you for
your posts.

macropod said:
Hi JAnderson,

OK, that's easy enough:

With your source document, you can omit the last Section break I referred to. Now, format the 1st Section with your desired
source
document layout. Next, select that Section break and bookmark it (Insert|Bookmark). I'll assume you called it 'Layout'

Now, go to the very start of your target document, and insert an INCLUDTEXT/MERGEFIELD combination, coded along the lines of:
{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc" Layout}

That's all you need to force the target document to adopt the source document's layout.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ah, now I understand where the miscommunication is. My objective is to have
the target margin adopt whatever margins the source document has. In
essence, I want my target document to "become" the source document. Thus, if
I merge in the "Zebra" document with its 0.3" margins, I want my final
product to have 0.3" margins. My current problem is that my current setup
causes the target document to have 0.3" margins only on the first page, and
the rest reverts back to the default of the target document, with text
shifted aside.

I will try adding section breaks at the beginning and end of the source
documents, but I'm curious if you have any additional suggestion now that I
have a better idea what I'm talking about :)

Thanks so much for your help,

:

Hi JAnderson,

OK, the target document requires 1" margins before & after the souce document, but the source documents can have varying
margins.

So, for each source document:
.. insert a Section break at the very start of the document.
.. insert a Section break at the very end of the document.
and format the Sections thus created (ie the new Section 1 and the new last Section) with 1" margins, and give the rest of the
source document whatever margins it requires. Also unlink the headers & footers for your new 2nd Section and last Section in
to
source document from that document's previous Sections and delete the heading from the new 1st Section.

With this approach, I don't see any need for a Section break to follow the mergfields in your target document.

--
Cheers
macropod
[MVP - Microsoft Word]


Hmm... That seems problematic. Say my target document has 1" margins and no
header/footer. Then, for example:

Penguin.doc = 0.5" margins, header and footer present
Lions.doc = 0.75" top margin, 0.35" right margin, header present
Zebra.doc = 0.3" margins all around, no header or footer

Resulting merged document = 1" margins, except for page 1.

I was hoping that by setting the INCLUDETEXT field up this way I could just
have one document that would incorporate the formatting characteristics of
all of the source documents, but it seems what you are saying is that is not
possible? I'm not sure how I could even work around this limitation then,
and I thought I was so close. Am I reading this wrong? Thanks,

:

Oh, BTW, I should have mentioned that the 1st Section in the source document should be formatted with the same attributes
as
the
target document.

--
Cheers
macropod
[MVP - Microsoft Word]


Hi JAnderson,

The symptoms you're describing suggest the source document has a different paper size than the target document.

As for indents & tabs, are you sure they're defined using the same defaults for both the source and target documents?

Do you think I should try a section break at the beginning AND end of the source documents?
Wouldn't hurt, especially if that Section break reverts the page layout settings to those used in the target document.

--
Cheers
macropod
[MVP - Microsoft Word]


From what you're describing, what I'm doing should work perfectly, you're
right. The best way I can describe what is going on is that only the first
page of my final product seems to observe the formatting; all remaining pages
revert to the target document's default settings. Furthermore, the text from
the source document does not line up with the indent arrows - instead it
falls off to the left of the page. It's very unusual. The same thing
happens with the header and footer on all pages after the first page.

Do you think I should try a section break at the beginning AND end of the
source documents? I'm SO close, I feel like I'm just missing one step.

Thanks again for all of your help,


:

Hi JAnderson,

Provided your:
.. source document (ie the one referenced by the INCLUDETEXT field) starts off with a Section break; and
.. target document (ie your mailmerge main document) has a Section break after the mergefields,
I don't believe the Section breaks in the source document will have any effect on the target document outside of those
Section
breaks.

As for the partial shifting, are you sure the source and target documents have the same page formats (eg A4)?

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, we're definitely getting closer - thank you! I did what you suggested by
placing a continuous section break at the beginning of my 'animal' documents,
and placed a section break after my INCLUDETEXT field.

Two problems:

1) Some of my 'animal' documents have multiple section breaks within the
document (separate footers, etc.). I'm not sure how this is affecting the
resulting document.

2) My resulting merged document only retains the correct formatting for the
first page, then reverts to the default formatting of the 'primary/host'
document. Furthermore, all text and headers/footers are shifted partially
off the visible area of the page (these are not unusual documents, just text
and some tables within the printable margins of a page).

I'm encouraged by the results so far; I really want to get to the point
where my INCLUDETEXT field can LITERALLY pull the entire document. All
mergefields within the INCLUDETEXT document are merging correctly, thankfully.

Any ideas why the formatting doesn't 'stick' on these documents? What about
adding a field switch to the INCLUDETEXT field, like *Charformat or something?

:

Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a
continuous
Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also.
Alternatively,
if
you
want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after
that,
make
the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


:

The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JAnderson wrote:
Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to
bears will become part of my document, otherwise, nothing happens
(the false condition is ""). Likewise, if "Zebra" is the value of
the field, then a document about zebras appears. Under any
condition, however, my "regular" document is always part of the
merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific
needs, and works without any problems. However, there becomes a
point where inserting one more "IF" statement will "break" the
whole document.

Say I realize that I need to add yet another document about Lions,
so I follow the formatting above and enter this Lion IF statement
right after the zebra IF statement. For some reason, headers,
footers and margins (section break qualities) will not be correct
for whatever document I merge, and sometimes the "next page"
section breaks will reorient themselves as "continuous", thus
melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a
section break is within an IF statement, it would later become
functional even though its condition is not met. Would it be more
effective if, every time I added a new IF statement, I re-built the
 
J

JAnderson

Yes, perfect- that works.

Okay, so after MUCH coaching from you, here's what I've got so far:

I am able to successfully merge my documents and Word retains all of the
formatting, headers, and footers. My target document is basically a 2-piece
document which looks like this (ignoring error handling for simplicity):

{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}
---Section break (next page)---

(one full blank page)

General information document begins here, multiple pages with headers/footers
---Section break (next page)---
(one full blank page)
(end of document)

To get to this point, I've found I need to have a section break at the very
end of every source document, and the header/footer at the beginning of any
source document cannot be entirely blank.

When I merge more than one record at a time, I am thus left with a lot of
blank or mostly-blank pages. Once merged: After my source document there is
the blank page (from the next page break) with headers/footers from the
source document. Then there is my 'general' document, after which I also
have a blank page. If the header in my subsequent source document is blank,
it will automatically activate 'link to previous', and I will obtain the
unwanted header from my prior document.

I guess my final question is how to merge these documents in a way that I
don't have to handle every document with such care- why should I need to have
next page breaks at the bottom of every source document just to force most of
the pages into the correct formatting? I find that I'm having nearly the
same problems that I did when I stuffed each of my documents into individual
IF statements.

Your solution is easily the most elegant, and I'm hoping there's some way
that I can set up my target document so as to avoid having to mess with each
individual source document.

Thanks as always,

macropod said:
Hi JAnderson,

For error handling, you can use code like:
{IF{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}= "Error!*" "" {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}}
The IF test examines the INCLUDETEXT result and, if it starts with 'Error!' (which I assume your 'Animal.doc' won't), then the
INCLUDETEXT result is suppressed but you'll still get the body of the target document.

If you want to supress the target document too, you could use a SKIPIF field, as in:
{SKIPIF{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}= "Error!*"}

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
I think I understand, using a slightly different methodology (no bookmarks).
But before I get there, I need some error handling.

Let's say my mergefield is "Panda", but for whatever reason, I don't have
any "Panda.doc", and I don't intend to have one. How can I use my
INCLUDETEXT field to return nothing at all if the document doesn't exist?
Currently, I get an error.

Your help has been invaluable on this. Thanks,

macropod said:
Hi JAnderson,

OK, that's easy enough:

With your source document, you can omit the last Section break I referred to. Now, format the 1st Section with your desired
source
document layout. Next, select that Section break and bookmark it (Insert|Bookmark). I'll assume you called it 'Layout'

Now, go to the very start of your target document, and insert an INCLUDTEXT/MERGEFIELD combination, coded along the lines of:
{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc" Layout}

That's all you need to force the target document to adopt the source document's layout.

--
Cheers
macropod
[MVP - Microsoft Word]


Ah, now I understand where the miscommunication is. My objective is to have
the target margin adopt whatever margins the source document has. In
essence, I want my target document to "become" the source document. Thus, if
I merge in the "Zebra" document with its 0.3" margins, I want my final
product to have 0.3" margins. My current problem is that my current setup
causes the target document to have 0.3" margins only on the first page, and
the rest reverts back to the default of the target document, with text
shifted aside.

I will try adding section breaks at the beginning and end of the source
documents, but I'm curious if you have any additional suggestion now that I
have a better idea what I'm talking about :)

Thanks so much for your help,

:

Hi JAnderson,

OK, the target document requires 1" margins before & after the souce document, but the source documents can have varying
margins.

So, for each source document:
.. insert a Section break at the very start of the document.
.. insert a Section break at the very end of the document.
and format the Sections thus created (ie the new Section 1 and the new last Section) with 1" margins, and give the rest of the
source document whatever margins it requires. Also unlink the headers & footers for your new 2nd Section and last Section in
to
source document from that document's previous Sections and delete the heading from the new 1st Section.

With this approach, I don't see any need for a Section break to follow the mergfields in your target document.

--
Cheers
macropod
[MVP - Microsoft Word]


Hmm... That seems problematic. Say my target document has 1" margins and no
header/footer. Then, for example:

Penguin.doc = 0.5" margins, header and footer present
Lions.doc = 0.75" top margin, 0.35" right margin, header present
Zebra.doc = 0.3" margins all around, no header or footer

Resulting merged document = 1" margins, except for page 1.

I was hoping that by setting the INCLUDETEXT field up this way I could just
have one document that would incorporate the formatting characteristics of
all of the source documents, but it seems what you are saying is that is not
possible? I'm not sure how I could even work around this limitation then,
and I thought I was so close. Am I reading this wrong? Thanks,

:

Oh, BTW, I should have mentioned that the 1st Section in the source document should be formatted with the same attributes
as
the
target document.

--
Cheers
macropod
[MVP - Microsoft Word]


Hi JAnderson,

The symptoms you're describing suggest the source document has a different paper size than the target document.

As for indents & tabs, are you sure they're defined using the same defaults for both the source and target documents?

Do you think I should try a section break at the beginning AND end of the source documents?
Wouldn't hurt, especially if that Section break reverts the page layout settings to those used in the target document.

--
Cheers
macropod
[MVP - Microsoft Word]


From what you're describing, what I'm doing should work perfectly, you're
right. The best way I can describe what is going on is that only the first
page of my final product seems to observe the formatting; all remaining pages
revert to the target document's default settings. Furthermore, the text from
the source document does not line up with the indent arrows - instead it
falls off to the left of the page. It's very unusual. The same thing
happens with the header and footer on all pages after the first page.

Do you think I should try a section break at the beginning AND end of the
source documents? I'm SO close, I feel like I'm just missing one step.

Thanks again for all of your help,


:

Hi JAnderson,

Provided your:
.. source document (ie the one referenced by the INCLUDETEXT field) starts off with a Section break; and
.. target document (ie your mailmerge main document) has a Section break after the mergefields,
I don't believe the Section breaks in the source document will have any effect on the target document outside of those
Section
breaks.

As for the partial shifting, are you sure the source and target documents have the same page formats (eg A4)?

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, we're definitely getting closer - thank you! I did what you suggested by
placing a continuous section break at the beginning of my 'animal' documents,
and placed a section break after my INCLUDETEXT field.

Two problems:

1) Some of my 'animal' documents have multiple section breaks within the
document (separate footers, etc.). I'm not sure how this is affecting the
resulting document.

2) My resulting merged document only retains the correct formatting for the
first page, then reverts to the default formatting of the 'primary/host'
document. Furthermore, all text and headers/footers are shifted partially
off the visible area of the page (these are not unusual documents, just text
and some tables within the printable margins of a page).

I'm encouraged by the results so far; I really want to get to the point
where my INCLUDETEXT field can LITERALLY pull the entire document. All
mergefields within the INCLUDETEXT document are merging correctly, thankfully.

Any ideas why the formatting doesn't 'stick' on these documents? What about
adding a field switch to the INCLUDETEXT field, like *Charformat or something?

:

Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a
continuous
Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also.
Alternatively,
if
you
want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after
that,
make
the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


:

The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JAnderson wrote:
Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
 
M

macropod

Hi JAnderson,

Unless you want those blank pages, I don't see the need to have the Next Page Section breaks in your target document.

You can kill off the unwanted 'link to previous' scenarios by inserting a Continuous Section break at the end of your target
document and unlinking the new Section from the previous one.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Yes, perfect- that works.

Okay, so after MUCH coaching from you, here's what I've got so far:

I am able to successfully merge my documents and Word retains all of the
formatting, headers, and footers. My target document is basically a 2-piece
document which looks like this (ignoring error handling for simplicity):

{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}
---Section break (next page)---

(one full blank page)

General information document begins here, multiple pages with headers/footers
---Section break (next page)---
(one full blank page)
(end of document)

To get to this point, I've found I need to have a section break at the very
end of every source document, and the header/footer at the beginning of any
source document cannot be entirely blank.

When I merge more than one record at a time, I am thus left with a lot of
blank or mostly-blank pages. Once merged: After my source document there is
the blank page (from the next page break) with headers/footers from the
source document. Then there is my 'general' document, after which I also
have a blank page. If the header in my subsequent source document is blank,
it will automatically activate 'link to previous', and I will obtain the
unwanted header from my prior document.

I guess my final question is how to merge these documents in a way that I
don't have to handle every document with such care- why should I need to have
next page breaks at the bottom of every source document just to force most of
the pages into the correct formatting? I find that I'm having nearly the
same problems that I did when I stuffed each of my documents into individual
IF statements.

Your solution is easily the most elegant, and I'm hoping there's some way
that I can set up my target document so as to avoid having to mess with each
individual source document.

Thanks as always,

macropod said:
Hi JAnderson,

For error handling, you can use code like:
{IF{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}= "Error!*" "" {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}}
The IF test examines the INCLUDETEXT result and, if it starts with 'Error!' (which I assume your 'Animal.doc' won't), then the
INCLUDETEXT result is suppressed but you'll still get the body of the target document.

If you want to supress the target document too, you could use a SKIPIF field, as in:
{SKIPIF{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}= "Error!*"}

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
I think I understand, using a slightly different methodology (no bookmarks).
But before I get there, I need some error handling.

Let's say my mergefield is "Panda", but for whatever reason, I don't have
any "Panda.doc", and I don't intend to have one. How can I use my
INCLUDETEXT field to return nothing at all if the document doesn't exist?
Currently, I get an error.

Your help has been invaluable on this. Thanks,

:

Hi JAnderson,

OK, that's easy enough:

With your source document, you can omit the last Section break I referred to. Now, format the 1st Section with your desired
source
document layout. Next, select that Section break and bookmark it (Insert|Bookmark). I'll assume you called it 'Layout'

Now, go to the very start of your target document, and insert an INCLUDTEXT/MERGEFIELD combination, coded along the lines of:
{INCLUDETEXT "C:\\My Documents\\Animals\\{MERGEFIELD ANIMAL}.doc" Layout}

That's all you need to force the target document to adopt the source document's layout.

--
Cheers
macropod
[MVP - Microsoft Word]


Ah, now I understand where the miscommunication is. My objective is to have
the target margin adopt whatever margins the source document has. In
essence, I want my target document to "become" the source document. Thus, if
I merge in the "Zebra" document with its 0.3" margins, I want my final
product to have 0.3" margins. My current problem is that my current setup
causes the target document to have 0.3" margins only on the first page, and
the rest reverts back to the default of the target document, with text
shifted aside.

I will try adding section breaks at the beginning and end of the source
documents, but I'm curious if you have any additional suggestion now that I
have a better idea what I'm talking about :)

Thanks so much for your help,

:

Hi JAnderson,

OK, the target document requires 1" margins before & after the souce document, but the source documents can have varying
margins.

So, for each source document:
.. insert a Section break at the very start of the document.
.. insert a Section break at the very end of the document.
and format the Sections thus created (ie the new Section 1 and the new last Section) with 1" margins, and give the rest of
the
source document whatever margins it requires. Also unlink the headers & footers for your new 2nd Section and last Section
in
to
source document from that document's previous Sections and delete the heading from the new 1st Section.

With this approach, I don't see any need for a Section break to follow the mergfields in your target document.

--
Cheers
macropod
[MVP - Microsoft Word]


Hmm... That seems problematic. Say my target document has 1" margins and no
header/footer. Then, for example:

Penguin.doc = 0.5" margins, header and footer present
Lions.doc = 0.75" top margin, 0.35" right margin, header present
Zebra.doc = 0.3" margins all around, no header or footer

Resulting merged document = 1" margins, except for page 1.

I was hoping that by setting the INCLUDETEXT field up this way I could just
have one document that would incorporate the formatting characteristics of
all of the source documents, but it seems what you are saying is that is not
possible? I'm not sure how I could even work around this limitation then,
and I thought I was so close. Am I reading this wrong? Thanks,

:

Oh, BTW, I should have mentioned that the 1st Section in the source document should be formatted with the same
attributes
as
the
target document.

--
Cheers
macropod
[MVP - Microsoft Word]


Hi JAnderson,

The symptoms you're describing suggest the source document has a different paper size than the target document.

As for indents & tabs, are you sure they're defined using the same defaults for both the source and target documents?

Do you think I should try a section break at the beginning AND end of the source documents?
Wouldn't hurt, especially if that Section break reverts the page layout settings to those used in the target document.

--
Cheers
macropod
[MVP - Microsoft Word]


From what you're describing, what I'm doing should work perfectly, you're
right. The best way I can describe what is going on is that only the first
page of my final product seems to observe the formatting; all remaining pages
revert to the target document's default settings. Furthermore, the text from
the source document does not line up with the indent arrows - instead it
falls off to the left of the page. It's very unusual. The same thing
happens with the header and footer on all pages after the first page.

Do you think I should try a section break at the beginning AND end of the
source documents? I'm SO close, I feel like I'm just missing one step.

Thanks again for all of your help,


:

Hi JAnderson,

Provided your:
.. source document (ie the one referenced by the INCLUDETEXT field) starts off with a Section break; and
.. target document (ie your mailmerge main document) has a Section break after the mergefields,
I don't believe the Section breaks in the source document will have any effect on the target document outside of
those
Section
breaks.

As for the partial shifting, are you sure the source and target documents have the same page formats (eg A4)?

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, we're definitely getting closer - thank you! I did what you suggested by
placing a continuous section break at the beginning of my 'animal' documents,
and placed a section break after my INCLUDETEXT field.

Two problems:

1) Some of my 'animal' documents have multiple section breaks within the
document (separate footers, etc.). I'm not sure how this is affecting the
resulting document.

2) My resulting merged document only retains the correct formatting for the
first page, then reverts to the default formatting of the 'primary/host'
document. Furthermore, all text and headers/footers are shifted partially
off the visible area of the page (these are not unusual documents, just text
and some tables within the printable margins of a page).

I'm encouraged by the results so far; I really want to get to the point
where my INCLUDETEXT field can LITERALLY pull the entire document. All
mergefields within the INCLUDETEXT document are merging correctly, thankfully.

Any ideas why the formatting doesn't 'stick' on these documents? What about
adding a field switch to the INCLUDETEXT field, like *Charformat or something?

:

Hi JAnderson,

I think you'll get the results you're after if you make the first character of each of the 'animal' documents a
continuous
Section
break and if you insert a continuous Section break in your mailmerge document after the mergefields also.
Alternatively,
if
you
want
each of the 'animal' documents to start on a new page, and the mailmerge document to resume on a new page after
that,
make
the
section breaks 'next page'.

--
Cheers
macropod
[MVP - Microsoft Word]


Ah, that makes sense, thank you. It looks like the last of my problems is
formatting.

Each of my documents has different page setup dimensions (margins,
header/footer, etc.), by they seem to take on that of the main "host"
document, rather than keeping their original formatting. I can't think of a
way around this, but everything else is looking pretty good.

Any ideas? Thanks as always,


:

The point of the exercise was that you don't need the conditional
statements. The Includetext field inserts the appropriate document. And yes
you can put mergefields in the included documents and they will work
provided they match the fields in your data source.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JAnderson wrote:
Hmm... So could I still use conditional statements with INCLUDETEXT?
If my database record is 'zebra', I only want my zebra document to
show.

Also, would includetext retain formatting? It's important that I keep
margins, footers, and text formatting in a certain way.

Lastly, can INCLUDETEXT also accommodate mergefields? For example,
inside my zebra document are mergefields like 'zoo name' 'zoo
address' 'zoo city', etc., which merge from my database. This works
inside IF statements, but I wonder if it would with INCLUDETEXT...

Thanks,

:

Hi JAnderson,

You'd probably get better results by creating a separate reference
document for each scenario, then embedding your MERGEFIELD within an
INCLUDETEXT field pointing to the folder where those documents can
be found.

For example, suppose your refrence documents are in the folder C:\My
Documents\Animals and you have a series of files (eg Bear.doc,
Zebra.doc, etc) in that folder. In that case you could use an
INCLUDETEXT field coded as: {INCLUDETEXT "C:\\My
Documents\\Animals\\{MERGEFIELD ANIMAL}.doc"}

Now, if you add a new 'Animal' to your database, all you need to do
is to create a corresponding reference document for it in the folder
C:\My Documents\Animals.

--
Cheers
macropod
[MVP - Microsoft Word]


Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement
followed by a next-page section break. Let's pretend that I'm
using the merge field "Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top