Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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 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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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 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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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 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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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 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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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 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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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 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 | |
|
|
![]() |
||||
Thread | Forum | |||
Insert Field - Database - Wrong Date Format | Mailmerge | |||
Mailmerge with Excel as a database... Suppressing zero's in fields | Mailmerge | |||
Fields from Excel | Microsoft Word Help | |||
Excel Paste Link - Insert row problem | Microsoft Word Help | |||
Insert Excel Worksheets into Word Document | Microsoft Word Help |