Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Trim spaces from a mail merged field in Word 2007

Posted on 2015-02-20
6
Medium Priority
?
547 Views
Last Modified: 2016-02-11
I am building mail merged letters in Word 2007 from a .csv file.  I am exporting the file from a 3rd party application so do not have the ability to trim the field prior to the .csv file creation.  Is there a way in Word 2007 to trim a field that has spaces that need to be removed. (ex. Company Name field has the potential for a lot of trailing spaces.)
Is there a way to insert a space into a field after a Semicolon? (ex. Address field that has the Street, City, State and Zip as one field with no spaces following the semicolons)
0
Comment
Question by:PJ_KD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 24

Assisted Solution

by:Phillip Burton
Phillip Burton earned 500 total points
ID: 40621559
Use the Find and Replace function (Ctrl+H).
 
1. Find: two spaces.
Replace: one space.
 
Repeat several time.
 
2. Find: semicolon
Replace: semicolon and space.
 
Then repeat number 1.
0
 

Author Comment

by:PJ_KD
ID: 40621576
Is there no automated means to do this like the trim function in Excel?
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40621581
Only through a macro. But it only takes about 1 minute to do the above.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 40621587
We are generally reliant on Word Field operations during a mail merge and that doesn't provide a way of editing part of a field. It could be done with VBA, but it would be better to do it before presenting the file to the merge.

If you can use the file as an input to the mail merge, you should be able to input it to some other process, edit it, and present the result to the merge.

Excel can open .csv files, so that would be the best. Word can open .csv files and the text can then be converted into tables for mail merge input, but the process gets tricky if there are embedded separator characters (commas) in the fields.
0
 

Author Closing Comment

by:PJ_KD
ID: 40626529
I appreciate the input from  you both.  I was really hoping for an automated solution, if that was possible since there will be many letters occurring for the foreseeable  future.  I revised the mail merge main document so that the deletion of the spaces will not be an issue.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 40626880
You could use VBA to automate the procedure thus:

1. Read the supplied file line, by line
2. Do the required modifications and output to another file (both spaces and semi-colon)
3, Run the mail merge with the revised file as input.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question