Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Mail Merge

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 01-18-2018, 10:34 AM
RMerckling RMerckling is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: Jan 2018
Posts: 29
RMerckling is on a distinguished road
Question Field Codes - IF Statements, IncludeText Automatic Numbering

Hello all,

New to the forums and excited to be a part of the community. I have an issue here I've been scratching my head over for the past week or so, hoping someone can find a solution.

I have a template that I'll be distributing to my team, the template is purely composed of Include Text functions that call from 2 source documents. I can bring in all the data just fine, plenty of IF statements scattered in there to determine which bookmarked fields to bring based on Merge Fields in a Mail Merge.



The issue I'm having is that I cannot find a way to number the sections of the document dynamically. I tried doing if statements for the numbers but it gets too complex later in the document and my Word 2010 just can't handle when I have too many field codes (I think this is due to the source documents being located on a Network Drive?) Originally, I had planned to just code out all the different scenarios and number everything through long IF Statements but that brings editing the code of the document to about 1-2 minutes per character! Impossible for me to finalize it.

Next, I tried to create headers in the source documents and template document that would automatically number the headers... this seems to work but only if I do a basic INCLUDE TEXT function. If I use an IF Statement, the code brings in the bookmarked section just fine, but leaves out the number?

For example:

{ IF "MERGEFIELD Type2" = "Amendment" "{INCLUDETEXT "DocLocation" Bookmark1}" "{INCLUDETEXT "DocLocation" Bookmark2}" }

Results in the correct bookmark being placed... but no number before the header.

While,
{INCLUDETEXT "Document Location" Bookmark1 \* MERGEFORMAT}

Results in the correct bookmark being placed, and a number 2. before the header to signify there's a header above it... which there is... but it receives no visible number?

Then I tried SEQ NumList .... which results in a 1, 2, 3 regardless if it shows in the if statement or not, which is totally useless for this scenario, I need it to only show a number if it is placed in the document, in order.

Can anyone think of a solution, please? I've been working on this template for quite some time now and am really almost there minus this annoyance.

Thank you!
-Rich
Reply With Quote
  #2  
Old 01-18-2018, 11:37 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,191
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Does your bookmarked range in the source document include the terminating paragraph break from the source document, or are you attaching the field to an empty paragraph in the target document? You might try including the terminating paragraph and preceding breaks from the source document and attaching the INCLUDETEXT field to the preceding paragraph.

FWIW, your first INCLUDETEXT field could be reduced to:{QUOTE "{INCLUDETEXT "DocLocation" "Bookmark{IF{MERGEFIELD Type2}= "Amendment" 1 2}"}"}
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
Reply

Tags
automatic numbering, field code, includetext

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
odd behaviour with {includetext} field eNGiNe Word 1 10-19-2017 05:57 AM
VBA Code to search for field codes with certain text before the Field code and to change style welcometocandyland Word VBA 4 02-08-2017 06:53 PM
FORMTEXT field contained in INCLUDETEXT bookmark emwinschuh Word 1 08-17-2015 08:55 AM
Hyperlinks in an Includetext field do not work. Source and target on SharePoint witwabbit Word 2 11-06-2013 01:06 PM
Formula Field using Field Codes hunter2193 Word 3 04-05-2013 04:58 AM


All times are GMT -7. The time now is 01:38 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft