Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
Bo Rasmussen
 
Posts: n/a
Default Mail merge as seperate files.

Hi,

I would like to be able to save individual files (i.e. one per record in the
datasource) from a mail merge. Using VBA it is relatively easy to obtain
each merge result (record) as a section which I can easily save as a file.
My problem is that I want the filename to be that of one of the merge
fields. It seems however that in the merge result all fields are gone - now
they are just pure text. So there is no way I can easily reference them.
Does anybody know how to do this?

Kind regards
Bo Rasmussen


  #2   Report Post  
Posted to microsoft.public.word.newusers
Cindy M -WordMVP-
 
Posts: n/a
Default Mail merge as seperate files.

Hi Bo,

I would like to be able to save individual files (i.e. one per record in the
datasource) from a mail merge. Using VBA it is relatively easy to obtain
each merge result (record) as a section which I can easily save as a file.
My problem is that I want the filename to be that of one of the merge
fields. It seems however that in the merge result all fields are gone - now
they are just pure text. So there is no way I can easily reference them.
Does anybody know how to do this?

The only way you could to this would be to access the main merge document in
your code and loop through the records in order to pick up the fields. use
doc.MailMerge.DataSource.ActiveRecord = [number or WD-constant] to
- go to the first record at the beginning
- move to the next record in each part of the loop

To get the value of a particular field
doc.MailMerge.DataSource.DataFields("Name").Value

Note that this could be excruciatingly slow if a lot of records are involved.
In that case, it might make more sense to access the data source directly
using an ADO connection (assuming the source isn't a Word table).

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

  #3   Report Post  
Posted to microsoft.public.word.newusers
Bo Rasmussen
 
Posts: n/a
Default Mail merge as seperate files.

Hi Cindy,

I was hoping it would be easier. Actually my idea was to apply some style to
the mergefield that should be used as filename. Then I could use a StyleRef
field to obtain the value. But everything disappears in the merge result -
both style and StyleRef field. Why does that happen?

Kind regards
Bo


"Cindy M -WordMVP-" wrote in message
news:VA.0000b94b.008f42fc@speedy...
Hi Bo,

I would like to be able to save individual files (i.e. one per record in

the
datasource) from a mail merge. Using VBA it is relatively easy to obtain
each merge result (record) as a section which I can easily save as a

file.
My problem is that I want the filename to be that of one of the merge
fields. It seems however that in the merge result all fields are gone -

now
they are just pure text. So there is no way I can easily reference them.
Does anybody know how to do this?

The only way you could to this would be to access the main merge document

in
your code and loop through the records in order to pick up the fields. use
doc.MailMerge.DataSource.ActiveRecord = [number or WD-constant] to
- go to the first record at the beginning
- move to the next record in each part of the loop

To get the value of a particular field
doc.MailMerge.DataSource.DataFields("Name").Value

Note that this could be excruciatingly slow if a lot of records are

involved.
In that case, it might make more sense to access the data source directly
using an ADO connection (assuming the source isn't a Word table).

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)



  #4   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor
 
Posts: n/a
Default Mail merge as seperate files.

There's an add-in available from my web site that provides this function
http://www.gmayor.com/individual_merge_letters.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Bo Rasmussen wrote:
Hi Cindy,

I was hoping it would be easier. Actually my idea was to apply some
style to the mergefield that should be used as filename. Then I could
use a StyleRef field to obtain the value. But everything disappears
in the merge result - both style and StyleRef field. Why does that
happen?

Kind regards
Bo


"Cindy M -WordMVP-" wrote in message
news:VA.0000b94b.008f42fc@speedy...
Hi Bo,

I would like to be able to save individual files (i.e. one per
record in the datasource) from a mail merge. Using VBA it is
relatively easy to obtain each merge result (record) as a section
which I can easily save as a file. My problem is that I want the
filename to be that of one of the merge fields. It seems however
that in the merge result all fields are gone - now they are just
pure text. So there is no way I can easily reference them. Does
anybody know how to do this?

The only way you could to this would be to access the main merge
document in your code and loop through the records in order to pick
up the fields. use doc.MailMerge.DataSource.ActiveRecord =
[number or WD-constant] to
- go to the first record at the beginning
- move to the next record in each part of the loop

To get the value of a particular field
doc.MailMerge.DataSource.DataFields("Name").Value

Note that this could be excruciatingly slow if a lot of records are
involved. In that case, it might make more sense to access the data
source directly using an ADO connection (assuming the source isn't a
Word table).

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :-)



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I mail merge to EMAIL from MS Word AND add a pdf attachment Lily@Insight Mailmerge 24 January 15th 07 09:33 PM
mail merge documents moved from one server to another server don't Derek Ruesch Mailmerge 0 September 8th 05 06:36 PM
Splitter Macro - Separating Files from mail merge Parisa Mailmerge 4 May 16th 05 07:52 PM
Proteced Form with Mail Merge Section-Mail Merge is "lost" whe F. Ferrer Microsoft Word Help 0 February 2nd 05 08:27 PM
Mail merge toolbar unavailable after SP3 R Scott Lowden Mailmerge 1 December 1st 04 06:24 PM


All times are GMT +1. The time now is 05:28 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"