Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
Hi -
I'm not sure this is the exact right forum for this question, but hopefully it's close enough! I'm trying to use the Word field "if...then...else" in a merge-data document. The snag is that I want to conditionally include an item in the middle of a numbered list, but I don't seem able to imbed the list element formatting within the "if" construct. 1. is there a way to do this with this construct? 2. is there a *better* way to do this? Thanks for any help... mz |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
The forum is OK, but I believe we need a bit more information on what it is
that you are starting with (i.e. details of the data) and what you are trying to achieve. Information on the latter is probably best conveyed by a mock-up of the desired result. If you can give us that, it will give a better chance of being able to help you. -- Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP wrote in message oups.com... Hi - I'm not sure this is the exact right forum for this question, but hopefully it's close enough! I'm trying to use the Word field "if...then...else" in a merge-data document. The snag is that I want to conditionally include an item in the middle of a numbered list, but I don't seem able to imbed the list element formatting within the "if" construct. 1. is there a way to do this with this construct? 2. is there a *better* way to do this? Thanks for any help... mz |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
I'd be happy to do a mock-up. I'm relatively new to these boards -- do
I attach a short Word file somehow, or just put a bit of text inline here? Thanks... |
#4
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
And as long as I'm asking simplistic questions: how can I imbed
carriage returns in the text within an "if" word field? I'm having trouble getting the paragraph spacing the way that I want it using the "if" field, and I'm thinking that if I just manually take control of the carriage returns, I can make it work. Thanks... |
#5
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
Include paragraph marks in the result texts, e.g. if you have
{ IF X = Y "abc" "def" } and you want ab c if X = Y, put the insertion point after "ab" in the field and press Enter so you have { IF X = Y "ab c "def" } (i.e. it's probably more obvious than you realised :-) ) However, whether that will help solve your problem I cannot tell. Peter Jamieson wrote in message oups.com... And as long as I'm asking simplistic questions: how can I imbed carriage returns in the text within an "if" word field? I'm having trouble getting the paragraph spacing the way that I want it using the "if" field, and I'm thinking that if I just manually take control of the carriage returns, I can make it work. Thanks... |
#6
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
No, attachments are frowned upon.
Just create it as best you can in the body of the message that you post to the group. -- 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 wrote in message ups.com... I'd be happy to do a mock-up. I'm relatively new to these boards -- do I attach a short Word file somehow, or just put a bit of text inline here? Thanks... |
#7
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
On Mar 29, 11:33 am, "Peter Jamieson"
wrote: Include paragraph marks in the result texts, e.g. if you have { IF X = Y "abc" "def" } and you want ab c if X = Y, put the insertion point after "ab" in the field and press Enter so you have { IF X = Y "ab c "def" } (i.e. it's probably more obvious than you realised :-) ) However, whether that will help solve your problem I cannot tell. Yeah, sadly, that doesn't seem to work for me. The new paragraphs are evident when in "View Field Code" mode, but they show up in white, and don't appear to be included within the quotes holding the conditional text. Here's what I'm trying to do with lists: - list item number 1. this applies to all documents blah blah blah... - list item number 2. this applies to all documents blah blah blah... { IF {MERGEFIELD EntityType } = "Consultant" "- list item number 3. this applies to documents pertaining to consultants blah blah blah..." "" } - list item number 4. this applies to all documents blah blah blah... and so on and so forth. According to the online help, text formatting isn't passed along with the text inside the "IF" statement. Evidently, this includes list element formatting. The problem is, if I leave the list item definition in the main document, it appears (as a blank) even when the "IF" is false. As I mentioned before, I'm totally open to other ways of approaching this problem. Thanks again... |
#8
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
Will have to look again for numbered lists, sorry. (FWIW I never found an
approach that worked before, but that doesn't mean there is no workable approach) Peter Jamieson wrote in message oups.com... On Mar 29, 11:33 am, "Peter Jamieson" wrote: Include paragraph marks in the result texts, e.g. if you have { IF X = Y "abc" "def" } and you want ab c if X = Y, put the insertion point after "ab" in the field and press Enter so you have { IF X = Y "ab c "def" } (i.e. it's probably more obvious than you realised :-) ) However, whether that will help solve your problem I cannot tell. Yeah, sadly, that doesn't seem to work for me. The new paragraphs are evident when in "View Field Code" mode, but they show up in white, and don't appear to be included within the quotes holding the conditional text. Here's what I'm trying to do with lists: - list item number 1. this applies to all documents blah blah blah... - list item number 2. this applies to all documents blah blah blah... { IF {MERGEFIELD EntityType } = "Consultant" "- list item number 3. this applies to documents pertaining to consultants blah blah blah..." "" } - list item number 4. this applies to all documents blah blah blah... and so on and so forth. According to the online help, text formatting isn't passed along with the text inside the "IF" statement. Evidently, this includes list element formatting. The problem is, if I leave the list item definition in the main document, it appears (as a blank) even when the "IF" is false. As I mentioned before, I'm totally open to other ways of approaching this problem. Thanks again... |
#9
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
Hi mzimmers,
You can put a whole word document insie and IF field if you want, inluding paragraph breaks, page & section breaks - all except for the final paragraph mark. For an idea of how to go about this, take a look at the topics under the heading titled 'Use Date (And/Or Time) Comparisons To Vary Text' in my Date Calc 'tutorial', at: http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 Cheers -- macropod [MVP - Microsoft Word] ------------------------- wrote in message oups.com... On Mar 29, 11:33 am, "Peter Jamieson" wrote: Include paragraph marks in the result texts, e.g. if you have { IF X = Y "abc" "def" } and you want ab c if X = Y, put the insertion point after "ab" in the field and press Enter so you have { IF X = Y "ab c "def" } (i.e. it's probably more obvious than you realised :-) ) However, whether that will help solve your problem I cannot tell. Yeah, sadly, that doesn't seem to work for me. The new paragraphs are evident when in "View Field Code" mode, but they show up in white, and don't appear to be included within the quotes holding the conditional text. Here's what I'm trying to do with lists: - list item number 1. this applies to all documents blah blah blah... - list item number 2. this applies to all documents blah blah blah... { IF {MERGEFIELD EntityType } = "Consultant" "- list item number 3. this applies to documents pertaining to consultants blah blah blah..." "" } - list item number 4. this applies to all documents blah blah blah... and so on and so forth. According to the online help, text formatting isn't passed along with the text inside the "IF" statement. Evidently, this includes list element formatting. The problem is, if I leave the list item definition in the main document, it appears (as a blank) even when the "IF" is false. As I mentioned before, I'm totally open to other ways of approaching this problem. Thanks again... |
#10
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
If I have understood your requirement correctly, I think what you have to do
is abandon Word's built-in list numbering and use fields to generate the numbers. There are a few obvious field types you could try (e.g. { SEQ }, { AUTONUM } and { LISTNUM }, but IME itt's difficult to get any of them to work how you want - e.g. Word processes { SEQ } inside an IF field "true" result even when it ends up inserting the "false" result and vice versa, so numbering after the IF goes haywire. Try the following which seems to work in a simple example he { SET S 1 }{ S } This should be bullet 1 { SET S {=S+1 } }{ S } This should be bullet 2 { IF {MERGEFIELD EntityType } = "Consultant" "{ SET S {=S+1 } }{ S } If present, this should be bullet 3 " "" }{ SET S {=S+1 } }{ S } This could be bullet 3 or 4 Peter Jamieson "Peter Jamieson" wrote in message ... Will have to look again for numbered lists, sorry. (FWIW I never found an approach that worked before, but that doesn't mean there is no workable approach) Peter Jamieson wrote in message oups.com... On Mar 29, 11:33 am, "Peter Jamieson" wrote: Include paragraph marks in the result texts, e.g. if you have { IF X = Y "abc" "def" } and you want ab c if X = Y, put the insertion point after "ab" in the field and press Enter so you have { IF X = Y "ab c "def" } (i.e. it's probably more obvious than you realised :-) ) However, whether that will help solve your problem I cannot tell. Yeah, sadly, that doesn't seem to work for me. The new paragraphs are evident when in "View Field Code" mode, but they show up in white, and don't appear to be included within the quotes holding the conditional text. Here's what I'm trying to do with lists: - list item number 1. this applies to all documents blah blah blah... - list item number 2. this applies to all documents blah blah blah... { IF {MERGEFIELD EntityType } = "Consultant" "- list item number 3. this applies to documents pertaining to consultants blah blah blah..." "" } - list item number 4. this applies to all documents blah blah blah... and so on and so forth. According to the online help, text formatting isn't passed along with the text inside the "IF" statement. Evidently, this includes list element formatting. The problem is, if I leave the list item definition in the main document, it appears (as a blank) even when the "IF" is false. As I mentioned before, I'm totally open to other ways of approaching this problem. Thanks again... |
#11
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
Hey, Peter...thanks for the response; that method looks promising. I
stumbled on entering the "{ S }", though...what command do you use for that? |
#12
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
It's just a REF field, i.e. you can (and probably should!) use { REF S }
As usual: ctrl-F9 to create the { } Type an S between them. Peter Jamieson wrote in message oups.com... Hey, Peter...thanks for the response; that method looks promising. I stumbled on entering the "{ S }", though...what command do you use for that? |
#13
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
OK...that works beautifully. Now, the final snag I seem to have is
that that last carriage return I enter (before the first closing quote in the IF statement) doesn't "take". The following list item just comes right on the tails of the text in the IF statement. Any ideas? Could it be a setting of mine? I am using double spaced paragraphs and no empty paragraphs in this document, if that matters. |
#14
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
Oops...please disregard that last post. Word seems to be occasionally
reluctant to properly update the WYSIWYG for these constructs, and I have to toggle the preview a couple of times to get it right. I think you've got this one whipped. Thanks a ton! |
#15
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
FWIW it's just possible that you have a glitch in a display driver. Word is
reputed to drive the display quite hard (I suppose you'd think that was mainly the preserve of fact action games, but maybe not :-)) Peter Jamieson wrote in message oups.com... Oops...please disregard that last post. Word seems to be occasionally reluctant to properly update the WYSIWYG for these constructs, and I have to toggle the preview a couple of times to get it right. I think you've got this one whipped. Thanks a ton! |
#16
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
On Mar 30, 1:02 pm, wrote:
Oops...please disregard that last post. Word seems to be occasionally reluctant to properly update the WYSIWYG for these constructs, and I have to toggle the preview a couple of times to get it right. I think you've got this one whipped. Thanks a ton! A followup question: I created and edited this file on a Mac (using Word 2004) and then transferred it to a Windows machine (running Word 2003). All of my visible values for the list numbers were set to the value of the final list element (13 in this case). Any ideas? |
#17
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
1. What if you select the document (e.g. control-A) and re-execute all the
fields (F9)? 2. Word will actually display the /current/ value of any REF field when you re-execute it. The { = } approach only works because Word executes all the fields sequentially from the beginnin gof the document. So at one point when it executes { S }, it will be 1, then after the next { = } , it will be 2, and so on. But if you actually go back and select and re-execute, that first { S }, it will have the same value as the last in the list. Peter Jamieson wrote in message ups.com... On Mar 30, 1:02 pm, wrote: Oops...please disregard that last post. Word seems to be occasionally reluctant to properly update the WYSIWYG for these constructs, and I have to toggle the preview a couple of times to get it right. I think you've got this one whipped. Thanks a ton! A followup question: I created and edited this file on a Mac (using Word 2004) and then transferred it to a Windows machine (running Word 2003). All of my visible values for the list numbers were set to the value of the final list element (13 in this case). Any ideas? |
#18
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
Hi, Peter -
I'm not sure that I understand -- are you saying that I should, or should not, re-execute? From your response, it sounds like re- executing will mess up my numbering. If this is the case, what is the cure? Thanks...sorry if I'm being a bit dense on this one. mz On Apr 5, 12:57 am, "Peter Jamieson" wrote: 1. What if you select the document (e.g. control-A) and re-execute all the fields (F9)? 2. Word will actually display the /current/ value of any REF field when you re-execute it. The { = } approach only works because Word executes all the fields sequentially from the beginnin gof the document. So at one point when it executes { S }, it will be 1, then after the next { = } , it will be 2, and so on. But if you actually go back and select and re-execute, that first { S }, it will have the same value as the last in the list. Peter Jamieson |
#19
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
From your response, it sounds like re-
executing will mess up my numbering From your question, it sounds as if your numbering was already messed up. If not, can you be more precise about the problem? If so, you probably aren't going to make things worse. As long as you save a copy of the file, you can try re-executing the fields and see if it works without damaging anything, right? Is the file you transferred from the Mac the Mail Merge Main document or the result of the merge? If it's the result, did it look OK on the Mac? If you use Alt-F9 to reveal the field codes, do you see any of the { = } or { S } field codes? We're already using a workaround because Word doesn't really do what you want. Mucking around in the middle of the job transferrring stuff from Mac to Windows seems to me to be pushing your luck. If you have to do the merge on the Mac and the results are OK there, how about saving the result as a ..pdf (assuming you've got the built-in facility on Mac OS X instead? Peter Jamieson wrote in message oups.com... Hi, Peter - I'm not sure that I understand -- are you saying that I should, or should not, re-execute? From your response, it sounds like re- executing will mess up my numbering. If this is the case, what is the cure? Thanks...sorry if I'm being a bit dense on this one. mz On Apr 5, 12:57 am, "Peter Jamieson" wrote: 1. What if you select the document (e.g. control-A) and re-execute all the fields (F9)? 2. Word will actually display the /current/ value of any REF field when you re-execute it. The { = } approach only works because Word executes all the fields sequentially from the beginnin gof the document. So at one point when it executes { S }, it will be 1, then after the next { = } , it will be 2, and so on. But if you actually go back and select and re-execute, that first { S }, it will have the same value as the last in the list. Peter Jamieson |
#20
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
Hi, Peter -
Today was my first chance to test this on a Windows machine. I went in and individually updated each field, and got the document correct on the screen. When I printed, or even did a print preview, the problem returned that all the numbers were set to the final value. Not sure what is causing this, but it does it on the Mac platform, too. Using the data merge manager to select a new record causes the fields to return to their correct values, until the next print attempt. I may have to give up on this one, but if anyone has any final ideas, I'm willing to give them a fling. Thanks... On Apr 5, 3:51 pm, "Peter Jamieson" wrote: From your response, it sounds like re- executing will mess up my numbering From your question, it sounds as if your numbering was already messed up. If not, can you be more precise about the problem? If so, you probably aren't going to make things worse. As long as you save a copy of the file, you can try re-executing the fields and see if it works without damaging anything, right? Is the file you transferred from the Mac the Mail Merge Main document or the result of the merge? If it's the result, did it look OK on the Mac? If you use Alt-F9 to reveal the field codes, do you see any of the { = } or { S } field codes? We're already using a workaround because Word doesn't really do what you want. Mucking around in the middle of the job transferrring stuff from Mac to Windows seems to me to be pushing your luck. If you have to do the merge on the Mac and the results are OK there, how about saving the result as a .pdf (assuming you've got the built-in facility on Mac OS X instead? Peter Jamieson wrote in message oups.com... Hi, Peter - I'm not sure that I understand -- are you saying that I should, or should not, re-execute? From your response, it sounds like re- executing will mess up my numbering. If this is the case, what is the cure? Thanks...sorry if I'm being a bit dense on this one. mz On Apr 5, 12:57 am, "Peter Jamieson" wrote: 1. What if you select the document (e.g. control-A) and re-execute all the fields (F9)? 2. Word will actually display the /current/ value of any REF field when you re-execute it. The { = } approach only works because Word executes all the fields sequentially from the beginnin gof the document. So at one point when it executes { S }, it will be 1, then after the next { = } , it will be 2, and so on. But if you actually go back and select and re-execute, that first { S }, it will have the same value as the last in the list. Peter Jamieson |
#21
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
Ah yes, I see what you mean.
One thing you can do is select the document prior to print or preview and use ctrl-shift-F9 to "unlink" all the fields, leaving their results. I don't think I've ever worked out another scheme that avoids VBA. Peter Jamieson wrote in message ups.com... Hi, Peter - Today was my first chance to test this on a Windows machine. I went in and individually updated each field, and got the document correct on the screen. When I printed, or even did a print preview, the problem returned that all the numbers were set to the final value. Not sure what is causing this, but it does it on the Mac platform, too. Using the data merge manager to select a new record causes the fields to return to their correct values, until the next print attempt. I may have to give up on this one, but if anyone has any final ideas, I'm willing to give them a fling. Thanks... On Apr 5, 3:51 pm, "Peter Jamieson" wrote: From your response, it sounds like re- executing will mess up my numbering From your question, it sounds as if your numbering was already messed up. If not, can you be more precise about the problem? If so, you probably aren't going to make things worse. As long as you save a copy of the file, you can try re-executing the fields and see if it works without damaging anything, right? Is the file you transferred from the Mac the Mail Merge Main document or the result of the merge? If it's the result, did it look OK on the Mac? If you use Alt-F9 to reveal the field codes, do you see any of the { = } or { S } field codes? We're already using a workaround because Word doesn't really do what you want. Mucking around in the middle of the job transferrring stuff from Mac to Windows seems to me to be pushing your luck. If you have to do the merge on the Mac and the results are OK there, how about saving the result as a .pdf (assuming you've got the built-in facility on Mac OS X instead? Peter Jamieson wrote in message oups.com... Hi, Peter - I'm not sure that I understand -- are you saying that I should, or should not, re-execute? From your response, it sounds like re- executing will mess up my numbering. If this is the case, what is the cure? Thanks...sorry if I'm being a bit dense on this one. mz On Apr 5, 12:57 am, "Peter Jamieson" wrote: 1. What if you select the document (e.g. control-A) and re-execute all the fields (F9)? 2. Word will actually display the /current/ value of any REF field when you re-execute it. The { = } approach only works because Word executes all the fields sequentially from the beginnin gof the document. So at one point when it executes { S }, it will be 1, then after the next { = } , it will be 2, and so on. But if you actually go back and select and re-execute, that first { S }, it will have the same value as the last in the list. Peter Jamieson |
#22
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
using Word field "if" for a list item?
One thing that does work is to use the "merge to new document"
command. The numbers remain intact during the print process. Not exactly the most convenient of all solutions, but, at least it's done. Thanks for all the help, everyone. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
eliminate "copy" of "saved as" document showing up in file list | Microsoft Word Help | |||
"Print current page" should have a "+n pages" field. | Microsoft Word Help | |||
New field for Word: {SCREENTIP "DisplayText" "TipText"} | Microsoft Word Help | |||
How to turn "a list of bullet points" into a "task check list/box" ? | Tables |