Changing Templates During Merge

F

Frank

I think this involves using VBA as the solution.
I have 2 templates defined. I need to setup a mail merge using a csv file
as my datasource. Depending on a value in the CSV file, I need to toggle
between
the 2 different templates. Is there a link on how to do this or can someone
assist me with the solution. Greatly appreciate any help or direction.
Frank
 
D

Doug Robbins - Word MVP

And you want to do this on the run?

Maybe you could use an IncludeText field inside and If...then...Else...
field that checks for the value of the field in the datasource and includes
the necessary text depending upon the result.

Another way maybe to use a SkipRecord If field in each of the main
documents.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
F

Frank

Thanks for the reply Doug. Yes, on the run, the idea was when I detected a
value in the csv record, I would use a different template to populate the
fields. The templates are letters written in different languages. I read
about the includetext, maybe that is the way to go. Not sure, this is pretty
new to me.

Frank
 
D

Doug Robbins - Word MVP

Actually, having two documents that use the same data source, each with the
appropriate Skip Record If field construction might be the best way to go.
Then you execute the merge for each document.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
F

Frank

Doug
That actually sounds like a good idea. The data file is being created from a
mainframe job, so keeping the one file intact would be better than splitting
the file up. Is the SkipRecord a syntactical command I may find documentation
on?

Thanks again

Frank
 
D

Doug Robbins - Word MVP

It's a Word Field that can be used in a mailmerge document. With the field
codes revealed, the syntax is

{ SKIPIF { MERGEFIELD [fieldnametotest] } = "[test]" }

As an example if you had a mergefield with the name of "Document" in which
you had either the values One or Two and if the value was One you wanted to
records merged in mailmerge main document One and if it was Two, you wanted
it merged in mailmerge document Two, in document One, you would have

{ SKIPIF { MERGEFIELD Document } = "Two" }

and in document Two you would have:

{ SKIPIF { MERGEFIELD Document } = "One" }

If you are entering these field constructions into the main document
directly from the keyboard, you must use Ctrl+F9 to insert each pair of
field delimiters { } and you use Alt+F9 to toggle off their display.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
F

Frank

That great Doug. Will be working with it today, I'll let you know how I do.

Frank

Doug Robbins - Word MVP said:
It's a Word Field that can be used in a mailmerge document. With the field
codes revealed, the syntax is

{ SKIPIF { MERGEFIELD [fieldnametotest] } = "[test]" }

As an example if you had a mergefield with the name of "Document" in which
you had either the values One or Two and if the value was One you wanted to
records merged in mailmerge main document One and if it was Two, you wanted
it merged in mailmerge document Two, in document One, you would have

{ SKIPIF { MERGEFIELD Document } = "Two" }

and in document Two you would have:

{ SKIPIF { MERGEFIELD Document } = "One" }

If you are entering these field constructions into the main document
directly from the keyboard, you must use Ctrl+F9 to insert each pair of
field delimiters { } and you use Alt+F9 to toggle off their display.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Frank said:
Doug
That actually sounds like a good idea. The data file is being created from
a
mainframe job, so keeping the one file intact would be better than
splitting
the file up. Is the SkipRecord a syntactical command I may find
documentation
on?

Thanks again

Frank
 
F

Frank

Doug,
That worked just great with my test template and a test file. The
interesting thing
is you have to complete the merge for skip to fire. If you preview it, you
still
see all of the letters including the one(s) to be skipped.

Thanks Again


Frank said:
That great Doug. Will be working with it today, I'll let you know how I do.

Frank

Doug Robbins - Word MVP said:
It's a Word Field that can be used in a mailmerge document. With the field
codes revealed, the syntax is

{ SKIPIF { MERGEFIELD [fieldnametotest] } = "[test]" }

As an example if you had a mergefield with the name of "Document" in which
you had either the values One or Two and if the value was One you wanted to
records merged in mailmerge main document One and if it was Two, you wanted
it merged in mailmerge document Two, in document One, you would have

{ SKIPIF { MERGEFIELD Document } = "Two" }

and in document Two you would have:

{ SKIPIF { MERGEFIELD Document } = "One" }

If you are entering these field constructions into the main document
directly from the keyboard, you must use Ctrl+F9 to insert each pair of
field delimiters { } and you use Alt+F9 to toggle off their display.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Frank said:
Doug
That actually sounds like a good idea. The data file is being created from
a
mainframe job, so keeping the one file intact would be better than
splitting
the file up. Is the SkipRecord a syntactical command I may find
documentation
on?

Thanks again

Frank

:

Actually, having two documents that use the same data source, each with
the
appropriate Skip Record If field construction might be the best way to
go.
Then you execute the merge for each document.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Thanks for the reply Doug. Yes, on the run, the idea was when I
detected a
value in the csv record, I would use a different template to populate
the
fields. The templates are letters written in different languages. I
read
about the includetext, maybe that is the way to go. Not sure, this is
pretty
new to me.

Frank

:

And you want to do this on the run?

Maybe you could use an IncludeText field inside and
If...then...Else...
field that checks for the value of the field in the datasource and
includes
the necessary text depending upon the result.

Another way maybe to use a SkipRecord If field in each of the main
documents.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

I think this involves using VBA as the solution.
I have 2 templates defined. I need to setup a mail merge using a csv
file
as my datasource. Depending on a value in the CSV file, I need to
toggle
between
the 2 different templates. Is there a link on how to do this or can
someone
assist me with the solution. Greatly appreciate any help or
direction.
Frank
 

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