Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.newusers
|
|||
|
|||
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
Posted to microsoft.public.word.newusers
|
|||
|
|||
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
Posted to microsoft.public.word.newusers
|
|||
|
|||
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
Posted to microsoft.public.word.newusers
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I mail merge to EMAIL from MS Word AND add a pdf attachment | Mailmerge | |||
mail merge documents moved from one server to another server don't | Mailmerge | |||
Splitter Macro - Separating Files from mail merge | Mailmerge | |||
Proteced Form with Mail Merge Section-Mail Merge is "lost" whe | Microsoft Word Help | |||
Mail merge toolbar unavailable after SP3 | Mailmerge |