View Single Post
  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Excel Data Filtered for Unique records

Hi Peter,

Presumably one could also embed a SKIPIF field in the mailmerge main document, coded with logic that is functionally equivalent to
the filter in Excel.

--
Cheers
macropod
[MVP - Microsoft Word]


"Peter Jamieson" wrote in message ...
I am fairly sure that if you filter "in situ" in Excel, you will only be able to use the filtered data successfuly in Word merge,
directly from Excel, if you
a. also sort the data so that all the records you want are right at the beginning of the list
b. select the filtered data and create a range name
c. re-connect to the Excel workbook from Word and select the range name as the data source rather than the worksheet.

However, in that case you would probably be better off if you could simply sort the data so that the data you want is at the
beginning, then apply and use a range name. Otherwise, I am not sure you can avoid including records that you do not want.

Alternative approaches a
a. filter in Word (the facilities in Word are a bit limited, but may be enough
b. copy/paste the filtered data into a word document and use that as the data source. However, if you are filtering to eliminate
duplicates, I do not think that will work either
c. use Word VBA's OpenDataSource method to specify a filter in SQL - typically a SELECT DISTINCT - this can be more flexible than
using the Word user interface to do it, but obviously requires that you either know or learn enough VBA and SQL to do it.

Perhaps that's enough to suggest that it might be simpler to make a copy of the filtered data in Excel despite the downside.

Peter Jamieson

http://tips.pjmsn.me.uk

George wrote:
I am using an Excel 2007 data file which I have filtered for unique records. I want the file to merge with my Word Template as it
shows. However, the filtering is removed when I perform the merge. How can I retain the filtering (I don't want to copy field
values to a new worksheet because I still want the formulas to work)??

Thanks in advance!