Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating dynamic cross reference links in a Word document | Microsoft Word Help | |||
autoshape text wrapping | Page Layout | |||
How do I keep text boxes on the left and not alternate with pages? | Microsoft Word Help | |||
Outline | Page Layout | |||
textbox to normal text | New Users |