MS Office Forum / Word / Mailmerge and Fax / April 2007
using Word field "if" for a list item?
|
|
Thread rating:  |
mzimmers@gmail.com - 29 Mar 2007 01:28 GMT 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
Doug Robbins - Word MVP - 29 Mar 2007 04:38 GMT 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.
 Signature Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis.
Doug Robbins - Word MVP
> Hi - > [quoted text clipped - 12 lines] > > mz mzimmers@gmail.com - 29 Mar 2007 17:51 GMT 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...
mzimmers@gmail.com - 29 Mar 2007 19:25 GMT 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...
Peter Jamieson - 29 Mar 2007 19:33 GMT 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
> 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... mzimmers@gmail.com - 29 Mar 2007 21:40 GMT On Mar 29, 11:33 am, "Peter Jamieson" <p...@KillmapSpjjnet.demon.co.uk> wrote:
> Include paragraph marks in the result texts, e.g. if you have > [quoted text clipped - 13 lines] > (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...
Peter Jamieson - 29 Mar 2007 22:44 GMT 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
> On Mar 29, 11:33 am, "Peter Jamieson" > <p...@KillmapSpjjnet.demon.co.uk> wrote: [quoted text clipped - 39 lines] > As I mentioned before, I'm totally open to other ways of approaching > this problem. Thanks again... Peter Jamieson - 30 Mar 2007 09:59 GMT 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 here:
{ 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
> 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 [quoted text clipped - 46 lines] >> As I mentioned before, I'm totally open to other ways of approaching >> this problem. Thanks again... mzimmers@gmail.com - 30 Mar 2007 20:21 GMT Hey, Peter...thanks for the response; that method looks promising. I stumbled on entering the "{ S }", though...what command do you use for that?
Peter Jamieson - 30 Mar 2007 20:28 GMT 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
> Hey, Peter...thanks for the response; that method looks promising. I > stumbled on entering the "{ S }", though...what command do you use for > that? mzimmers@gmail.com - 30 Mar 2007 20:56 GMT 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.
mzimmers@gmail.com - 30 Mar 2007 21:02 GMT 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!
Peter Jamieson - 30 Mar 2007 21:09 GMT 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
> 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! mzimmers@gmail.com - 04 Apr 2007 23:32 GMT On Mar 30, 1:02 pm, mzimm...@gmail.com 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?
Peter Jamieson - 05 Apr 2007 08:57 GMT 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
> On Mar 30, 1:02 pm, mzimm...@gmail.com wrote: >> Oops...please disregard that last post. Word seems to be occasionally [quoted text clipped - 6 lines] > 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? mzimmers@gmail.com - 05 Apr 2007 18:51 GMT 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" <p...@KillmapSpjjnet.demon.co.uk> wrote:
> 1. What if you select the document (e.g. control-A) and re-execute all the > fields (F9)? [quoted text clipped - 7 lines] > > Peter Jamieson Peter Jamieson - 05 Apr 2007 23:51 GMT > 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
> Hi, Peter - > [quoted text clipped - 26 lines] >> >> Peter Jamieson mzimmers@gmail.com - 10 Apr 2007 23:26 GMT 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" <p...@KillmapSpjjnet.demon.co.uk> wrote:
> > From your response, it sounds like re- > > executing will mess up my numbering [quoted text clipped - 53 lines] > > >> Peter Jamieson Peter Jamieson - 11 Apr 2007 00:12 GMT 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
> Hi, Peter - > [quoted text clipped - 79 lines] >> >> >> Peter Jamieson mzimmers@gmail.com - 17 Apr 2007 23:00 GMT 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.
macropod - 30 Mar 2007 07:24 GMT 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/showthreaded.pl?Number=249902
Cheers
 Signature macropod [MVP - Microsoft Word] -------------------------
> On Mar 29, 11:33 am, "Peter Jamieson" > <p...@KillmapSpjjnet.demon.co.uk> wrote: [quoted text clipped - 38 lines] > As I mentioned before, I'm totally open to other ways of approaching > this problem. Thanks again... Doug Robbins - Word MVP - 29 Mar 2007 19:43 GMT No, attachments are frowned upon.
Just create it as best you can in the body of the message that you post to the group.
 Signature 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'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...
|
|
|