Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
James James is offline
external usenet poster
 
Posts: 113
Default Can I truncate merged text - eg using Left, Right, etc?

Hi - My mergefield returns a string whicih is a random number from 1 to a
million but with four characters at the end. Eg 12345.fed or 1.fed, etc. I'd
like to remove the .fed suffix and just display the numbered portion of the
mergefield. Can i do this?
Many thanks
James
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Can I truncate merged text - eg using Left, Right, etc?

The best place to manipulate data is in the data source.

You cannot use Left, Right etc. in a merge field and there is no formatting
switch that can be used to cause only the numerals to be displayed.

The only possible way of doing it is if you have the data being inserted
into the cells of table and have the paragraph containing the mergefield
right aligned with a negative right indent in the paragraph definition that
causes the unwanted part of the data to "disappear" out the right-hand side
of the cell.

Of course, after executing the merge, you could use EditReplace to replace
the unwanted part of the data with nothing.

--
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

"James" wrote in message
...
Hi - My mergefield returns a string whicih is a random number from 1 to a
million but with four characters at the end. Eg 12345.fed or 1.fed, etc.
I'd
like to remove the .fed suffix and just display the numbered portion of
the
mergefield. Can i do this?
Many thanks
James



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Can I truncate merged text - eg using Left, Right, etc?

You may be able to use a numeric format switch to do this - e.g. instead of

{ MERGEFIELD myfield }

use

{ MERGEFIELD myfield \#0 }

(You can Alt-f9 to show the field codes).

It works in simple cases but you need to test with your own data.

Other than that, there are no "right" "left" type functions in the Word
field "language" but if you use VBA to open the data source you can issue
SQL that uses "left", "right" type functions if they are supported by the
data source (e.g. it is possible if your data comes from Access but not if
it is coming from Word), and it is sometimes possible to use a DATABASE
field to do something similar.

Peter Jamieson


"James" wrote in message
...
Hi - My mergefield returns a string whicih is a random number from 1 to a
million but with four characters at the end. Eg 12345.fed or 1.fed, etc.
I'd
like to remove the .fed suffix and just display the numbered portion of
the
mergefield. Can i do this?
Many thanks
James



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
James James is offline
external usenet poster
 
Posts: 113
Default Can I truncate merged text - eg using Left, Right, etc?

Unfortnately I cant get at the data source as it comes from a 3rd party
application and we can't run macros either (for "security" reasons).
Nevertheless, your main suggestion re aligning table cells works perfectly!
I'm very grateful.
Thanks
James

"Doug Robbins - Word MVP" wrote:

The best place to manipulate data is in the data source.

You cannot use Left, Right etc. in a merge field and there is no formatting
switch that can be used to cause only the numerals to be displayed.

The only possible way of doing it is if you have the data being inserted
into the cells of table and have the paragraph containing the mergefield
right aligned with a negative right indent in the paragraph definition that
causes the unwanted part of the data to "disappear" out the right-hand side
of the cell.

Of course, after executing the merge, you could use EditReplace to replace
the unwanted part of the data with nothing.

--
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

"James" wrote in message
...
Hi - My mergefield returns a string whicih is a random number from 1 to a
million but with four characters at the end. Eg 12345.fed or 1.fed, etc.
I'd
like to remove the .fed suffix and just display the numbered portion of
the
mergefield. Can i do this?
Many thanks
James




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating dynamic cross reference links in a Word document torajudo Microsoft Word Help 5 April 27th 23 08:57 PM
autoshape text wrapping cayce Page Layout 6 June 16th 06 09:42 PM
How do I keep text boxes on the left and not alternate with pages? Deepak Shenoy Microsoft Word Help 1 February 19th 06 12:39 AM
Outline Renee Hendershott Page Layout 2 December 25th 04 02:49 PM
textbox to normal text Jack Sons New Users 16 December 5th 04 03:44 PM


All times are GMT +1. The time now is 11:50 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"