View Single Post
  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Cross References nested in if field in mailmerge

I am using Word's auto numbering with up to 4 levels. There are between
100
and 150 clauses depending upon the user input. I don't want to use
manually
typed paragraph numbers.


I have replicated what you have as best I can for experimental purposes, can
see the problem you describe (i.e. where the reference has the para. number
with the correct levels but it always shows 1, 1.1 etc.).

I do not know a way to work around this using IF statements - as far as I
can see, Word generates the correct references for numbered paragraphs
outside the IF statements but not otherwise.

However, you may be able to work around it using a different approach where
you do the numbering using { SEQ } fields instead of using Word's automatic
numbering.

For example, to achieve 4-level 1.2.3.4 numbering, you can use the
following:

Put the following fields at the top of the document:
{ SEQ h1 \r0\h }{ SEQ h2 \r0\h }{ SEQ h3 \r0\h }{ SEQ h4 \r0\h }

Put the following fields at the beginning of each "1" level paragraph:

{ SEQ h1 }{ SEQ h2 \r0\h }{ SEQ h3 \r0\h }( SEQ h4 \r0\h }

Put the following fields at the beginning of each "1.2" level paragraph:

{ SEQ h1 \c }.{ SEQ h2 }{ SEQ h3 \r0\h }( SEQ h4 \r0\h }

Put the following fields at the beginning of each "1.2.3" level paragraph:

{ SEQ h1 \c }.{ SEQ h2 \c }.{ SEQ h3 }( SEQ h4 \r0\h }

Put the following fields at the beginning of each "1.2.3.4" level paragraph:

{ SEQ h1 \c }.{ SEQ h2 \c }.{ SEQ h3 \c }.( SEQ h4 }

For every paragraph you want to reference, select all the SEQ fields in the
para (or at least, the ones that generate visible numbers) and create a
bookmark. For example, for the first numbered paragraph in the document, use
"par1", for the second, use "par2" etc.

When you want to reference another paragraph, say, "par10", use { par10 },
or { REF par10 }

However, when you use this approach, using IF fields with { SEQ } fields
inside will not work properly (in essence, Word calculates the numbers
whether they are used in the document or not). So instead, you will need to
use INCLUDETEXT fields to include the pieces of document you need.

Because of additional problems if you try to use

{ IF a = b "{ INCLUDETEXT this }" "{ INCLUDETEXT that }" }

you really need to use an approach more like

{ INCLUDETEXT "c:\\mypath\\{ IF a = b "this" "that" }" }

where "this" and "that" are the file names you need or

{ INCLUDETEXT "c:\\mypath\\nyfile.doc" "{ IF a = b "this" "that" }" }

where "this" and "that" are bookmark names that cover the appropriate
portions of text in the included document.

(The latter approach that uses bookmarks is likely to work the best).

This approach has its pitfalls, but I think it is at least worth trying -
I'd start with a very simple feasibility tests and increase the complication
if you think it's worth it.

Otherwise, the only approach I know would be to use VBA and/or to generate
the document some other way altogether, e.g. using XML.

Peter Jamieson


cannot find a way to work around it. Basically, i don't think you're going
to be able to do it
"Dave Shaw" wrote in message
...
Thanks for your response...

An example of what a field may look like:

{IF { REF subtype1 \* MERGEFORMAT}="d" "" "

If an event of default under paragraph {REF _Ref138149796 \r \h \*
MERGEFORMAT} occurs.....

If....." }

The reference in this case could be to the second paragraph.

In the Word field the paragraphs appear indented indicating that they are
auto-numbered.

The output is always paragraph 1.1.1 (even though its not - once merged it
is say 2.3.12 - it does seem to pick up the number level correctly).

I am using Word's auto numbering with up to 4 levels. There are between
100
and 150 clauses depending upon the user input. I don't want to use
manually
typed paragraph numbers.

Re acrobat this is not a problem.

Can't send you any data because this is part of an integrated database
system used for generating single documents using mail merge - i.e. there
is
only one record.

Regards

Dave

"Peter Jamieson" wrote:

I'm not sure this will help, but...

a. when I tried this here, I got cross-references that used the same
numbering style as the referenced paragraphs. What do your
cross-reference
fields look like? How are you numbering the paragraphs? e.g. are you
using
auto-numbering? If so, are you using multi-level numbering, relying on
anything like outline levels etc.?
b. personally, I would not want to rely on Word's automatic numbering in
a
situation as complex as a merge with IF statements, particularly when
producing legal documents. (it's not even all that great in simpler
situations).
c. how many different possible combinations of paragraphs could you
possibly have? If it is a relatively small number, and there is no
possibility that it will suddenly become a much larger number (e.g.
because
someone needs to add one more para and that creates twice as many
combinations, etc.) I would be much more inclined to try to enumerate
each
possible case in full and not rely on automatic numbering or Word's
cross-referencing at all.
d. if you are merging to new documents and need to save electronic
version
so fthese documents, I would probably want to do something such as
Acrobat
them to be sure my documents did not alter their appearance in future. If
you can't do that because of the way your document production process has
to
work, think twice before proceeding!

[Ideally I would like after merging for the cross
references to remain in place but don't think there is a way of doing
this?]


I think you are right.

On the basic issue of the format of the cross-references, if you can
despam
my e-mail address and send me a copy of all or part of your mail merge
main
document (preferably with a small test data source) I will have a look
here
and see if I can spot anything.

Peter Jamieson

"Dave Shaw" Dave wrote in message
...
I have a document that uses an ASK field to ask the user a question upon
merging the document. The answer to this question is then used in an
IF
field to generate appropriate wording.

The wording then uses numbered paragraphs. Within some of these
paragraphs
I have to cross reference other paragraphs nested within this or other
IF
fields.

When the document is merged the paragraph numbering works correctly but
the
cross references always refer to 1 or 1.1 or 1.1.1.

Has anyone got any suggestions? - as this is a legal document the cross
references are vital. [Ideally I would like after merging for the
cross
references to remain in place but don't think there is a way of doing
this?]

VB/Macro solutions will not solve my problem as the merge is executed
through an application that prevents the running of other macros. I am
running Word 2003.