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  

Determine Length Of Mail Merge Field



 
 
Thread Tools Display Modes
  #1  
Old March 1st, 2010, 09:28 PM posted to microsoft.public.word.mailmerge.fields
Mark1110
external usenet poster
 
Posts: 3
Default Determine Length Of Mail Merge Field

Hi,

I have a mail merge document that gets its information from an excel file.
Is there a function in word that will give me the length of the one of the
fields, i.e. mm_name? If not, is there a way to treat a phone number (555)
555-1212 as one word so the (555) is not on one line and 555-1212 on another.
The user won't delete the space between after the ) or will the user start
the phone number on a separate line.

I am currently adding spaces before the phone number and if the mm_name is
under 12 characters the letter looks okay, however if it is over 12
characters you something like this:

Jonathon Longname (555) 555-1212.

If not, is there a way when the letter is printed to delete all instances of
spaces that 2 or greater and just make them one space?

Here is the statement I tried but with no luck:

IF {len({MERGEFIELD FullName}+ {MERGEFIELD FirstName}) 10 AND
len({MERGEFIELD FullName}+ {MERGEFIELD FirstName}) 19 SPACE(19 -
len({MERGEFIELD FullName}+ {MERGEFIELD FirstName})}

I have never tried this in a word document. Am I using the correct syntax?


Thanks,

Mark
  #2  
Old March 1st, 2010, 10:40 PM posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default Determine Length Of Mail Merge Field

See response in the VBA General newsgroup.

Please do not post questions separately to multiple newsgroups. Rather,
insert the names of all of the newsgroups into the header of a single
message.


--
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, originally posted via msnews.microsoft.com

"Mark1110" wrote in message
...
Hi,

I have a mail merge document that gets its information from an excel file.
Is there a function in word that will give me the length of the one of the
fields, i.e. mm_name? If not, is there a way to treat a phone number (555)
555-1212 as one word so the (555) is not on one line and 555-1212 on
another.
The user won't delete the space between after the ) or will the user start
the phone number on a separate line.

I am currently adding spaces before the phone number and if the mm_name is
under 12 characters the letter looks okay, however if it is over 12
characters you something like this:

Jonathon Longname (555) 555-1212.

If not, is there a way when the letter is printed to delete all instances
of
spaces that 2 or greater and just make them one space?

Here is the statement I tried but with no luck:

IF {len({MERGEFIELD FullName}+ {MERGEFIELD FirstName}) 10 AND
len({MERGEFIELD FullName}+ {MERGEFIELD FirstName}) 19 SPACE(19 -
len({MERGEFIELD FullName}+ {MERGEFIELD FirstName})}

I have never tried this in a word document. Am I using the correct syntax?


Thanks,

Mark


  #3  
Old March 1st, 2010, 10:40 PM posted to microsoft.public.word.mailmerge.fields
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default Determine Length Of Mail Merge Field

Hi Mark,

Word has no field manipulation tools for this. You'll need to modify the source data. For example, you could delete the spaces and
brackets, then use field maths in Word to parse the resulting mergefield and restore them - with brackets, non-breaking spaces
and/or non-breaking hyphens.

--
Cheers
macropod
[Microsoft MVP - Word]


"Mark1110" wrote in message ...
Hi,

I have a mail merge document that gets its information from an excel file.
Is there a function in word that will give me the length of the one of the
fields, i.e. mm_name? If not, is there a way to treat a phone number (555)
555-1212 as one word so the (555) is not on one line and 555-1212 on another.
The user won't delete the space between after the ) or will the user start
the phone number on a separate line.

I am currently adding spaces before the phone number and if the mm_name is
under 12 characters the letter looks okay, however if it is over 12
characters you something like this:

Jonathon Longname (555) 555-1212.

If not, is there a way when the letter is printed to delete all instances of
spaces that 2 or greater and just make them one space?

Here is the statement I tried but with no luck:

IF {len({MERGEFIELD FullName}+ {MERGEFIELD FirstName}) 10 AND
len({MERGEFIELD FullName}+ {MERGEFIELD FirstName}) 19 SPACE(19 -
len({MERGEFIELD FullName}+ {MERGEFIELD FirstName})}

I have never tried this in a word document. Am I using the correct syntax?


Thanks,

Mark


  #4  
Old March 2nd, 2010, 06:30 PM posted to microsoft.public.word.mailmerge.fields
Mark1110
external usenet poster
 
Posts: 3
Default Determine Length Of Mail Merge Field

I am sorry for the multiple posts. I may not be able to do what I want based
on the answers I received.

As a work around, is there a way to treat the contents of a mail merge field
as one word? For example a mail merge field myPhone contains (555) 555-1212.
If that field is at the end of a line it will be split with (555) being at
the end of one line and 555-1212 being at the beginning of the next. Is there
a way to treat the contents of myPhone as one word even though there is a
space in the field so if the mail merge field is at the end of a line the
whole phone number will be displayed on the next line without it being split.

Thanks,

Mark


  #5  
Old March 2nd, 2010, 09:05 PM posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default Determine Length Of Mail Merge Field

No, there is no way to do that, hence the work-arounds that have been
suggested.

--
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, originally posted via msnews.microsoft.com

"Mark1110" wrote in message
...
I am sorry for the multiple posts. I may not be able to do what I want
based
on the answers I received.

As a work around, is there a way to treat the contents of a mail merge
field
as one word? For example a mail merge field myPhone contains (555)
555-1212.
If that field is at the end of a line it will be split with (555) being at
the end of one line and 555-1212 being at the beginning of the next. Is
there
a way to treat the contents of myPhone as one word even though there is a
space in the field so if the mail merge field is at the end of a line the
whole phone number will be displayed on the next line without it being
split.

Thanks,

Mark


 




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 05:24 AM.


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