PDA

View Full Version : [SOLVED:] MailMerge doc to separate pdfs with name convention



gyurka03
07-18-2018, 07:56 AM
Hi,

I am quite new to VBA. I am currently working on a complicated problem.

The case is:
-I have a word document (.docm) with fields related to a database (.csv) file.

-We need to save pdfs separately from the .docm with a predefined name structure: ": „Contractnr_” + actual date + „_” + field.agent(value) + „_” + field.agentDescr(value) + „.pdf”

For example: Contractnr_18072018_12345_John Doe.pdf

Can anyone help please? It is quite urgent. (we have about 1200 records)

Thanks

macropod
07-18-2018, 03:47 PM
See Send Mailmerge Output to Individual Files in the Mailmerge Tips and Tricks thread at:
http://www.msofficeforums.com/mail-merge/21803-mailmerge-tips-tricks.html
or:
http://windowssecrets.com/forums/showthread.php/163017-Word-Mailmerge-Tips-amp-Tricks

gmayor
07-18-2018, 08:00 PM
http://www.gmayor.com/MergeAndSplit.htm will do that

gyurka03
07-19-2018, 02:48 AM
Thanks gmayor, the solution is perfect :) problem solved

gyurka03
07-20-2018, 04:43 AM
Your program works great.
But it has one little bug (or feature:) ), if you use a field more than one time in a document, the program will not generate the number of pdfs equal to the number of records in the csv. So there will be less pdfs generated than records in the csv file.
Can you please fix this issue? Thanks.