Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
eliminate trailing spaces on a mail merge field
How can I eliminate trailing spaces on an individual merge field?
The mail merge data source is a mainframe-generated semi-colon delimited .txt file (Excel/Access formatting is not an option) where the fields are all a fixed-length, but the values are not always the maximum field length. (text qualifiers such as " are not used). I want to eliminate these spaces in the letter text. Ex. CALL TIME field has a physical length of 20 positions, but may have the values DURING THE DAY or AT NIGHT |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
eliminate trailing spaces on a mail merge field
Word does not have a function to use only part of a field. The only
practical way I can see to do this is to edit the data file to remove the extra spaces. The following macro will remove all the extra spaces from a semicolon delimited text file Sub StripSpacesFromData() With Selection.Find .ClearFormatting .Replacement.ClearFormatting .Text = "[ ]@([;^13])" .Replacement.Text = "\1" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False .Execute replace:=wdReplaceAll End With End Sub http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "DaveS" wrote in message ... How can I eliminate trailing spaces on an individual merge field? The mail merge data source is a mainframe-generated semi-colon delimited .txt file (Excel/Access formatting is not an option) where the fields are all a fixed-length, but the values are not always the maximum field length. (text qualifiers such as " are not used). I want to eliminate these spaces in the letter text. Ex. CALL TIME field has a physical length of 20 positions, but may have the values DURING THE DAY or AT NIGHT |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need to eliminate double spaced address field in mail merge | Mailmerge | |||
eliminate trailing spaces in a mail merge field | Mailmerge | |||
Trailing spaces in columns | Page Layout | |||
How do I eliminate spaces resulting from blank mail merge fields? | Mailmerge | |||
Leading spaces in Mail Merge field not printing | Mailmerge |