Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / June 2005

Tip: Looking for answers? Try searching our database.

Merge the last 4 digits of a number that contains a hyphen

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lani - 23 Jun 2005 22:11 GMT
I use Microsoft Word 2002 (XP).  I am trying to merge the last 4 digits of a
number that in some cases includes a hyphen. The following switch works if
the number does not contain a hyphen i.e. Number = 123456789:
{QUOTE "XXXX"{MERGEFIELD Number \# x####}} field result = XXXX6789
When the number contains a hyphen Word subtracts the last number from the
four numbers that precede the hyphen i.e. 12345678-9 the field result =
XXXX5669.  How can I make Word ignore the hyphen and merge the field result =
XXXX678-9?
Peter Jamieson - 23 Jun 2005 23:24 GMT
Unfortunately I don't think you can do it using a field. Yes, there is a
strange "feature" where Word calculates some simple strings that look like
numeric expressions if you apply a numeric format, but when you think about
it, 12345678-9 isn't a number - it's an expression. So you really need a
character format that extracts the last 4 digits and anything along with it
(and there aren't any such character formats switches).

So you either have to fix the problem in the data source, or you have to do
something like use VBA and Mailmerge events to extract the correct text and
avoid applying formats. I'd head for the first of those if possible.

Peter Jamieson

>I use Microsoft Word 2002 (XP).  I am trying to merge the last 4 digits of
>a
[quoted text clipped - 6 lines]
> result =
> XXXX678-9?
Lani - 24 Jun 2005 00:42 GMT
I will try to use VBA to extract the correct text.  Thank you for the input.

> Unfortunately I don't think you can do it using a field. Yes, there is a
> strange "feature" where Word calculates some simple strings that look like
[quoted text clipped - 19 lines]
> > result =
> > XXXX678-9?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.