Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
MarvInBoise
 
Posts: n/a
Default Insert certain paragraphs based on fields in Excel database

Need to choose certain paragraphs to be inserted in Word document with mail
merge to an Excel file; the Excel file "letter" field can contain a character
defining the paragraph to be inserted, e.g., L=Liability pagragraph; the
"letter field can contain LCWG; each letter designates a different paragraph
be inserted.
--
Marv Lusk
Boise Corporation
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default Insert certain paragraphs based on fields in Excel database

If your paragraphs are quite simple you should be able to use IF fields,
e.g.

{ IF "{ MERGEFIELD letter }" = "L" "put the text of your liability paragraph
here" ""
}{ IF "{ MERGEFIELD letter }" = "C" "put the text of your C type paragraph
here" ""
}

etc.

Use ctrl-F9 to insert each pair of {}, and type everything else in the usual
way.

Peter Jamieson

"MarvInBoise" wrote in message
...
Need to choose certain paragraphs to be inserted in Word document with
mail
merge to an Excel file; the Excel file "letter" field can contain a
character
defining the paragraph to be inserted, e.g., L=Liability pagragraph; the
"letter field can contain LCWG; each letter designates a different
paragraph
be inserted.
--
Marv Lusk
Boise Corporation



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
MarvInBoise
 
Posts: n/a
Default Insert certain paragraphs based on fields in Excel database

Thank you, I played around with it and I think I can get it to work; however,
it only appears to work if I have one code in the "letter" field. If I have
LWC in the field, meaning it gets 3 paragraphs, it doesn't seem to work; if I
only have L or W or C individually, then it works. ??
--
Marv Lusk
Boise Corporation


"Peter Jamieson" wrote:

If your paragraphs are quite simple you should be able to use IF fields,
e.g.

{ IF "{ MERGEFIELD letter }" = "L" "put the text of your liability paragraph
here" ""
}{ IF "{ MERGEFIELD letter }" = "C" "put the text of your C type paragraph
here" ""
}

etc.

Use ctrl-F9 to insert each pair of {}, and type everything else in the usual
way.

Peter Jamieson

"MarvInBoise" wrote in message
...
Need to choose certain paragraphs to be inserted in Word document with
mail
merge to an Excel file; the Excel file "letter" field can contain a
character
defining the paragraph to be inserted, e.g., L=Liability pagragraph; the
"letter field can contain LCWG; each letter designates a different
paragraph
be inserted.
--
Marv Lusk
Boise Corporation




  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default Insert certain paragraphs based on fields in Excel database

Ah, I see. That's more difficult, because it's hard to look at parts of a
string using Word fields. The /simplest/ thing to do in this case is to
separate the codes in Excel (e.g. have four columns and "L" or blank etc.)

In theory you could also have one IF field for every possible combination,
but that's quite a lot of IF fields, e.g.

{ SET L "N" }{ SET C "N" }{ SET W "N" }{ SET G "N" }
{ IF "{ MERGEFIELD letter }" = "L" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "LC" "{ SET L "Y" }{ SET C "Y" }" ""
}

etc.


then { IF { L } = "Y" "put your L text here" "" }

and so on.

And that will only work if the sequence of the letters is irrelevant, i.e.
if LCW means use paras L, C, W in that order and LWC means use LWC in that
order, you would have to modifythat.


As long as you know that there can only be four letters and the sequence is
iirelevant you can cut the number of IF fields down by using wild cards,
e.g.

{ IF "{ MERGEFIELD letter }" = "L*" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "*L" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "?L*" "{ SET L "Y" }" ""
} IF "{ MERGEFIELD letter }" = "??L*" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "C*" "{ SET C "Y" }" ""
}

and so on.

if you know that the sequence is always LCWG, i.e. you can have L, LC, CW,
LWG etc. but not CL, you can simplify that a bit:

{ IF "{ MERGEFIELD letter }" = "L*" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "C*" "{ SET C "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "?C*" "{ SET C "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "W*" "{ SET W "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "?W*" "{ SET C "Y" }" ""
}

Alternatively, you can create a separate Word document - let's call it
c:\mydocs\paras.doc - containing the three paragraphs and create bookmarks
corresponding to each possible combination of letters. I would use bookmark
names "A", "AL", "AC" etc. where "A" means "none of the letters" because
then you can use

{ INCLUDETEXT "c:\\mydocs\\paras.doc" "A{ MERGEFIELD letter }" }

to include the correct text. If the paragraphs can be in different
seqeunces, you will need to create each sequence of paras. in paras.doc and
assign the appropriate bookmarks to each sequence.

It may be possible to do this a simpler way but my brain's not firing on all
cylinders at the moment...

Peter Jamieson
{ IF "{ MERGEFIELD letter }"
"MarvInBoise" wrote in message
...
Thank you, I played around with it and I think I can get it to work;
however,
it only appears to work if I have one code in the "letter" field. If I
have
LWC in the field, meaning it gets 3 paragraphs, it doesn't seem to work;
if I
only have L or W or C individually, then it works. ??
--
Marv Lusk
Boise Corporation


"Peter Jamieson" wrote:

If your paragraphs are quite simple you should be able to use IF fields,
e.g.

{ IF "{ MERGEFIELD letter }" = "L" "put the text of your liability
paragraph
here" ""
}{ IF "{ MERGEFIELD letter }" = "C" "put the text of your C type
paragraph
here" ""
}

etc.

Use ctrl-F9 to insert each pair of {}, and type everything else in the
usual
way.

Peter Jamieson

"MarvInBoise" wrote in message
...
Need to choose certain paragraphs to be inserted in Word document with
mail
merge to an Excel file; the Excel file "letter" field can contain a
character
defining the paragraph to be inserted, e.g., L=Liability pagragraph;
the
"letter field can contain LCWG; each letter designates a different
paragraph
be inserted.
--
Marv Lusk
Boise Corporation






  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
MarvInBoise
 
Posts: n/a
Default Insert certain paragraphs based on fields in Excel database

WOW, thanks Peter! You have given me many paths to pursue; I appreciate it!
--
Marv Lusk
Boise Corporation


"Peter Jamieson" wrote:

Ah, I see. That's more difficult, because it's hard to look at parts of a
string using Word fields. The /simplest/ thing to do in this case is to
separate the codes in Excel (e.g. have four columns and "L" or blank etc.)

In theory you could also have one IF field for every possible combination,
but that's quite a lot of IF fields, e.g.

{ SET L "N" }{ SET C "N" }{ SET W "N" }{ SET G "N" }
{ IF "{ MERGEFIELD letter }" = "L" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "LC" "{ SET L "Y" }{ SET C "Y" }" ""
}

etc.


then { IF { L } = "Y" "put your L text here" "" }

and so on.

And that will only work if the sequence of the letters is irrelevant, i.e.
if LCW means use paras L, C, W in that order and LWC means use LWC in that
order, you would have to modifythat.


As long as you know that there can only be four letters and the sequence is
iirelevant you can cut the number of IF fields down by using wild cards,
e.g.

{ IF "{ MERGEFIELD letter }" = "L*" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "*L" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "?L*" "{ SET L "Y" }" ""
} IF "{ MERGEFIELD letter }" = "??L*" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "C*" "{ SET C "Y" }" ""
}

and so on.

if you know that the sequence is always LCWG, i.e. you can have L, LC, CW,
LWG etc. but not CL, you can simplify that a bit:

{ IF "{ MERGEFIELD letter }" = "L*" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "C*" "{ SET C "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "?C*" "{ SET C "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "W*" "{ SET W "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "?W*" "{ SET C "Y" }" ""
}

Alternatively, you can create a separate Word document - let's call it
c:\mydocs\paras.doc - containing the three paragraphs and create bookmarks
corresponding to each possible combination of letters. I would use bookmark
names "A", "AL", "AC" etc. where "A" means "none of the letters" because
then you can use

{ INCLUDETEXT "c:\\mydocs\\paras.doc" "A{ MERGEFIELD letter }" }

to include the correct text. If the paragraphs can be in different
seqeunces, you will need to create each sequence of paras. in paras.doc and
assign the appropriate bookmarks to each sequence.

It may be possible to do this a simpler way but my brain's not firing on all
cylinders at the moment...

Peter Jamieson
{ IF "{ MERGEFIELD letter }"
"MarvInBoise" wrote in message
...
Thank you, I played around with it and I think I can get it to work;
however,
it only appears to work if I have one code in the "letter" field. If I
have
LWC in the field, meaning it gets 3 paragraphs, it doesn't seem to work;
if I
only have L or W or C individually, then it works. ??
--
Marv Lusk
Boise Corporation


"Peter Jamieson" wrote:

If your paragraphs are quite simple you should be able to use IF fields,
e.g.

{ IF "{ MERGEFIELD letter }" = "L" "put the text of your liability
paragraph
here" ""
}{ IF "{ MERGEFIELD letter }" = "C" "put the text of your C type
paragraph
here" ""
}

etc.

Use ctrl-F9 to insert each pair of {}, and type everything else in the
usual
way.

Peter Jamieson

"MarvInBoise" wrote in message
...
Need to choose certain paragraphs to be inserted in Word document with
mail
merge to an Excel file; the Excel file "letter" field can contain a
character
defining the paragraph to be inserted, e.g., L=Liability pagragraph;
the
"letter field can contain LCWG; each letter designates a different
paragraph
be inserted.
--
Marv Lusk
Boise Corporation








  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
MarvInBoise
 
Posts: n/a
Default Insert certain paragraphs based on fields in Excel database

Sorry Peter, but here I am again! I have the merge working based on letter
type (I did have to split it out into separate columns). Now my challenge
appears to be spacing and line returns based on whether paragraphs are merged
or not. Here is my code:

To continue to be an Approved Carrier for....:
{IF{MERGEFIELD "LetterG"} = "G"
"Certificate of General Liability...
rest of paragraph"}
{IF{MERGEFIELD "LetterL"} = "L"
"Certificate of General Liability...
rest of paragraph"}
{IF{MERGEFIELD "LetterC"} = "C"
"Certificate of General Liability...
rest of paragraph"}
{IF{MERGEFIELD "LetterW"} = "W"
"Certificate of General Liability...
rest of paragraph"}
All insurance.....
--
Marv Lusk
Boise Corporation


"MarvInBoise" wrote:

Need to choose certain paragraphs to be inserted in Word document with mail
merge to an Excel file; the Excel file "letter" field can contain a character
defining the paragraph to be inserted, e.g., L=Liability pagragraph; the
"letter field can contain LCWG; each letter designates a different paragraph
be inserted.
--
Marv Lusk
Boise Corporation

  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default Insert certain paragraphs based on fields in Excel database

If you always need a blank line (blank para.) at the bginning of each of
your text paragraphs, you can put a new para immediately after the ", e.g.

instead of

{ IF{ MERGEFIELD "LetterG" } = "G"
"Certificate of General Liability...
rest of paragraph" "" }

try

{ IF{ MERGEFIELD "LetterG" } = "G"
"
Certificate of General Liability...
rest of paragraph" "" }

etc.

Peter Jamieson

"MarvInBoise" wrote in message
...
Sorry Peter, but here I am again! I have the merge working based on
letter
type (I did have to split it out into separate columns). Now my challenge
appears to be spacing and line returns based on whether paragraphs are
merged
or not. Here is my code:

To continue to be an Approved Carrier for....:
{IF{MERGEFIELD "LetterG"} = "G"
"Certificate of General Liability...
rest of paragraph"}
{IF{MERGEFIELD "LetterL"} = "L"
"Certificate of General Liability...
rest of paragraph"}
{IF{MERGEFIELD "LetterC"} = "C"
"Certificate of General Liability...
rest of paragraph"}
{IF{MERGEFIELD "LetterW"} = "W"
"Certificate of General Liability...
rest of paragraph"}
All insurance.....
--
Marv Lusk
Boise Corporation


"MarvInBoise" wrote:

Need to choose certain paragraphs to be inserted in Word document with
mail
merge to an Excel file; the Excel file "letter" field can contain a
character
defining the paragraph to be inserted, e.g., L=Liability pagragraph; the
"letter field can contain LCWG; each letter designates a different
paragraph
be inserted.
--
Marv Lusk
Boise Corporation



  #8   Report Post  
Posted to microsoft.public.word.mailmerge.fields
MarvInBoise
 
Posts: n/a
Default Insert certain paragraphs based on fields in Excel database

Thanks Peter; I had to diddle around a bit more with the paragraph returns,
but I think I've got it. Thanks again!
--
Marv Lusk
Boise Corporation


"MarvInBoise" wrote:

WOW, thanks Peter! You have given me many paths to pursue; I appreciate it!
--
Marv Lusk
Boise Corporation


"Peter Jamieson" wrote:

Ah, I see. That's more difficult, because it's hard to look at parts of a
string using Word fields. The /simplest/ thing to do in this case is to
separate the codes in Excel (e.g. have four columns and "L" or blank etc.)

In theory you could also have one IF field for every possible combination,
but that's quite a lot of IF fields, e.g.

{ SET L "N" }{ SET C "N" }{ SET W "N" }{ SET G "N" }
{ IF "{ MERGEFIELD letter }" = "L" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "LC" "{ SET L "Y" }{ SET C "Y" }" ""
}

etc.


then { IF { L } = "Y" "put your L text here" "" }

and so on.

And that will only work if the sequence of the letters is irrelevant, i.e.
if LCW means use paras L, C, W in that order and LWC means use LWC in that
order, you would have to modifythat.


As long as you know that there can only be four letters and the sequence is
iirelevant you can cut the number of IF fields down by using wild cards,
e.g.

{ IF "{ MERGEFIELD letter }" = "L*" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "*L" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "?L*" "{ SET L "Y" }" ""
} IF "{ MERGEFIELD letter }" = "??L*" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "C*" "{ SET C "Y" }" ""
}

and so on.

if you know that the sequence is always LCWG, i.e. you can have L, LC, CW,
LWG etc. but not CL, you can simplify that a bit:

{ IF "{ MERGEFIELD letter }" = "L*" "{ SET L "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "C*" "{ SET C "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "?C*" "{ SET C "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "W*" "{ SET W "Y" }" ""
}{ IF "{ MERGEFIELD letter }" = "?W*" "{ SET C "Y" }" ""
}

Alternatively, you can create a separate Word document - let's call it
c:\mydocs\paras.doc - containing the three paragraphs and create bookmarks
corresponding to each possible combination of letters. I would use bookmark
names "A", "AL", "AC" etc. where "A" means "none of the letters" because
then you can use

{ INCLUDETEXT "c:\\mydocs\\paras.doc" "A{ MERGEFIELD letter }" }

to include the correct text. If the paragraphs can be in different
seqeunces, you will need to create each sequence of paras. in paras.doc and
assign the appropriate bookmarks to each sequence.

It may be possible to do this a simpler way but my brain's not firing on all
cylinders at the moment...

Peter Jamieson
{ IF "{ MERGEFIELD letter }"
"MarvInBoise" wrote in message
...
Thank you, I played around with it and I think I can get it to work;
however,
it only appears to work if I have one code in the "letter" field. If I
have
LWC in the field, meaning it gets 3 paragraphs, it doesn't seem to work;
if I
only have L or W or C individually, then it works. ??
--
Marv Lusk
Boise Corporation


"Peter Jamieson" wrote:

If your paragraphs are quite simple you should be able to use IF fields,
e.g.

{ IF "{ MERGEFIELD letter }" = "L" "put the text of your liability
paragraph
here" ""
}{ IF "{ MERGEFIELD letter }" = "C" "put the text of your C type
paragraph
here" ""
}

etc.

Use ctrl-F9 to insert each pair of {}, and type everything else in the
usual
way.

Peter Jamieson

"MarvInBoise" wrote in message
...
Need to choose certain paragraphs to be inserted in Word document with
mail
merge to an Excel file; the Excel file "letter" field can contain a
character
defining the paragraph to be inserted, e.g., L=Liability pagragraph;
the
"letter field can contain LCWG; each letter designates a different
paragraph
be inserted.
--
Marv Lusk
Boise Corporation






Reply
Thread Tools
Display Modes

Posting Rules

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Field - Database - Wrong Date Format dns2005 Mailmerge 3 February 23rd 06 05:04 PM
Mailmerge with Excel as a database... Suppressing zero's in fields Michael Mailmerge 5 August 22nd 05 02:49 PM
Fields from Excel Rahul Microsoft Word Help 1 December 23rd 04 10:27 PM
Excel Paste Link - Insert row problem yoyoyooreo Microsoft Word Help 1 December 17th 04 05:15 PM
Insert Excel Worksheets into Word Document Barb Reinhardt Microsoft Word Help 1 December 1st 04 07:30 PM


All times are GMT +1. The time now is 08:47 PM.

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

About Us

"It's about Microsoft Word"