word mailmerge field sort

J

jonnyb

Hi - I'm trying to apply a sort to a mailmerge field so that it automatically
sorts when the data is imported from a csv file. The field contains part
numbers (it can be anywhere from 1 to about 70 part numbers) and
unfortunately the product that creates the the csv does not have the
capability to sort on this particular field and I need them sorted ascending
for the process I am building.

Would anyone be able to let me know if this is possible, and maybe point me
in the right direction as to how I can accomplish this (code tips would be
much appreciated).

Thanks in advance - and please let me know if you need more details.

Jon
 
D

Doug Robbins - Word MVP

Open the csv file in Excel, sort it and save the sorted file to use as the
data source.
 
J

jonnyb

Thanks for the reply, but I guess I need to clarify - the csv file contains a
record for each transaction. In each record, there's a column that contains
part numbers for all of the items that were requested in the transaction.
All of these part numbers are contained in one cell of the record. I need to
sort the part numbers in each cell independently and each cell can contain
from 1 to 70 part numbers.

The solution provided would work if each record had a part number and I
wanted to sort all the records based on the part numbers, but unfortunately,
that's not the task that I need to accomplish.
 
D

Doug Robbins - Word MVP

A csv file must mean something different to you than it does to me (and I
think most other people). For starters, it does not contain cells.

A CSV (comma-separated values) file contains the values in a table as a
series of ASCII text lines organized so that each column value is separated
by a comma from the next column's value and each record starts a new line.

Provide an example of the data in the file and we can probably tell you how
to go about it.

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

jonnyb

Doug - thanks again for the response.

A CSV file means the same thing to me as it does to the rest of world, and
you are correct that I don't actually have "cells", but I thought that using
the "cell" analogy would help explain the task at hand.

Here's an example of what I'm talking about (in csv format):

CSV format:

Order_ID, Customer_Name, Part_Numbers

Sample Data for above format:

"1001", "John Smith", "001" "010" "007"
"1002", "Jill Jones", "031" "002"
"1003", "Bill Williams", "014" "002" "001"

I need to sort the third value (Part_Numbers) so that they appear in
ascending order on my mailmerge document. It would be great if the data
could come to me with either one Part_Number per record (with multiple
records for each order) or with each Part_Number seperated by commas, but the
client is not willing to change this feed (I guess it's used to feed other
programs so they do not want to change anythng for risk of breaking something
else that uses the feed).

Any ideas?

I'm actually thinking about just telling the client that they're out of luck
unless they presort the Part_Numbers during the build of the csv file.

Jon
 
D

Doug Robbins - Word MVP

If you want to send me a typical csv file, I can easily produce a macro that
will achieve what you want.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top