View Single Post
  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
baileycat baileycat is offline
external usenet poster
 
Posts: 2
Default mail merge data source shows 2 tables

Thanks Peter. Your example describes exactly the situation I encountered. I
am reassured to know it's 'just what happens'.

"Peter Jamieson" wrote:

I can't say I know all the details, but at some point you have probably
defined either a database (or database filter), a list or some grouping in
your Excel sheet, or you may simply have set a print area.

When you open an Excel data source from Word 2002 or later, Word uses OLE DB
to get the data. The OLE DB provider lists a number of things in the
workbook as "tables" - e.g. worksheets and named ranges. When you define a
database, or set a print area, Excel actually creates a named range.

However, what the OLE DB provider actually sees also depends on whether the
workbook is actually open in Excel or not. For example, I have a workbook
here with a database defined in Sheet1. When it is open, and I use it as a
data source, OLE DB lists Sheet1$ and Sheet1$_FilterDatabase as "Tables". I
can use either of them as a data source. If I close the workbook then try to
use it as a data source, it lists Sheet1$ and Sheet1$_, and I can only
successfully connect to Sheet1$, not Sheet1$_. In essence, I think the
Sheet1$_FilterDatabase "object" is only really "there" because Excel
constructs it when it opens the workbook, but it leaves something in the
..xls file that looks like a "table name" when it closes the workbook.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"baileycat" wrote in message
...
I'm using an excel file with one worksheet as my data source to merge to a
word document. First I select"Main document setup", then when I "Open
Data
Source" and the excel file, I get a pop-up to select the table. 2 tables
are
listed, both with the same name. Can you tell me why 2 tables are listed,
when there's only one worksheet in the excel file?