View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default MailMerge an Dataset

To use the built-in mailmerge you have to connect to one of several
types of data source - either a "file" such as a .doc(x), .txt etc., or
a "server" via DDE, ODBC or OLE DB. Unless you have the capability to
connect to your data source via one of those methods - e.g. if you can
persist it to a disk file that MailMerge can work with - you can't
really use the built-in mailmerge.

However, since you are already working with VB.NET you may be able to do
what you want in other ways - if you only have to work with word 2007
and later, one way is
a. create a custom XML part
a. put content controls, linked to that part, in the document
b. populate the custom XML part with data.

There's a two-part example starting at

http://blogs.msdn.com/erikaehrli/arc...tionPart1.aspx

I have never personally used this approach but think it is roughly the
direction Microsoft intended merge-type applications to go if they
cannot be done with the out-of-the-box facilities.


Peter Jamieson

http://tips.pjmsn.me.uk

On 05/01/2010 11:41, Johnny E. Jensen wrote:
Hello NG

I have a DataSet containing only one table - but unknown rows in that
table.
The DataSet is made using VB.NET

Now, is it possible to use that dataset to first design a template (dot
or dotx) containing mailmerge fields from the dataset.datatable.fields
and there after using the template to merge data from the dataset to the
mailmerge document.

Kind regards

Johnny Jensen