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 = "[ ][ at ]([;^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" <DaveS[ at ]discussions.microsoft.com> wrote in message news:87E64012-F067-4105-89CF-129547DE8451[ at ]microsoft.com...
[Quoted Text] > 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 >
|