A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Word Mail Merge / Forms - inserting "and" before the last item in alist in a sentence.



 
 
Thread Tools Display Modes
  #1  
Old January 28th, 2010, 08:36 PM posted to microsoft.public.word.mailmerge.fields
Larry Cortez
external usenet poster
 
Posts: 1
Default Word Mail Merge / Forms - inserting "and" before the last item in alist in a sentence.

I have created a Microsoft Word form in which users will imput names into NameField1, NameField2, ... NameField6. The input will be used to populate the non-form part of the document in sentences. The some sentences will use all of the names, some will use only some or one name. For instance a sentence may end,

..... Name1, Name2, Name3, Name4, Name5, and Name6.

Another may end,

..... Name1, Name3, Name4, and Name5.

My problem is that I cannot figure out how to programatically cause the "and" to fall before the last NameX in the list.

Any thoughts on how to accomplish this will be appreciated!

Larry


Submitted via EggHeadCafe - Software Developer Portal of Choice
New Idea to Convert DataReader to DataTable
http://www.eggheadcafe.com/tutorials...ert-datar.aspx
  #2  
Old January 28th, 2010, 11:03 PM posted to microsoft.public.word.mailmerge.fields
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default Word Mail Merge / Forms - inserting "and" before the last item in a list in a sentence.

Hi Larry,

You could use a nested 'IF' field construction like:
«NameField1»{IF«NameField6» "" ", «NameField2», «NameField3», «NameField4», «NameField5» and «NameField6»" {IF«NameField5» "" ",
«NameField2», «NameField3», «NameField4» and «NameField5»" {IF«NameField4» "" ", «NameField2», «NameField3» and «NameField4»"
{IF«NameField3» "" ", «NameField2» and «NameField3»" {IF«NameField2» "" " and «NameField2»" ""}}}}}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message. Likewise, you can't type or copy & paste the chevrons (ie '« »') - they're part of the actual mergefields,
which you can insert from the mailmerge toolbar.


--
Cheers
macropod
[Microsoft MVP - Word]


"Larry Cortez" wrote in message ...
I have created a Microsoft Word form in which users will imput names into NameField1, NameField2, ... NameField6. The input will
be used to populate the non-form part of the document in sentences. The some sentences will use all of the names, some will use
only some or one name. For instance a sentence may end,

.... Name1, Name2, Name3, Name4, Name5, and Name6.

Another may end,

.... Name1, Name3, Name4, and Name5.

My problem is that I cannot figure out how to programatically cause the "and" to fall before the last NameX in the list.

Any thoughts on how to accomplish this will be appreciated!

Larry


Submitted via EggHeadCafe - Software Developer Portal of Choice
New Idea to Convert DataReader to DataTable
http://www.eggheadcafe.com/tutorials...ert-datar.aspx


  #3  
Old January 29th, 2010, 09:22 AM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Word Mail Merge / Forms - inserting "and" before the last itemin a list in a sentence.

How will you know whether or not to include/exclude a name in any given
sentence?


Peter Jamieson

http://tips.pjmsn.me.uk

On 28/01/2010 20:36, Larry Cortez wrote:
I have created a Microsoft Word form in which users will imput names into NameField1, NameField2, ... NameField6. The input will be used to populate the non-form part of the document in sentences. The some sentences will use all of the names, some will use only some or one name. For instance a sentence may end,

..... Name1, Name2, Name3, Name4, Name5, and Name6.

Another may end,

..... Name1, Name3, Name4, and Name5.

My problem is that I cannot figure out how to programatically cause the "and" to fall before the last NameX in the list.

Any thoughts on how to accomplish this will be appreciated!

Larry


Submitted via EggHeadCafe - Software Developer Portal of Choice
New Idea to Convert DataReader to DataTable
http://www.eggheadcafe.com/tutorials...ert-datar.aspx

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.