![]() |
#1
|
|||
|
|||
![]()
Hello!
I created a brief script which allows me to save the preview results of single mail merge record (Word 2010) directly to .pdf without having to complete the actual merge to a new file. It uses a filename based on a bookmark ("UniqueName") of several merge fields. This allows me to save the result with a filename from the results of the merge fields (note: I must toggle to preview results prior to executing the macro or I'll just wind up with a filename based on the merge field names, not the results). Since bookmarks don't "survive" the merge process, I'm wondering whether I can accomplish the same thing for multiple records...? Would it be possible to do a variation of Socrates01's code to have it cycle through each mail merge preview record and save it as a .pdf? So, if I had 5 or 500 mail merge preview records, could I fire a macro that would peel them all off individually and save them each to a .pdf, each with their unique filename from the preview results? Here is what I use to do this with one record at a time*: Code:
Sub PREVIEW2PDFfromBookmark() Dim UniqueFileName As String UniqueFileName = ActiveDocument.Bookmarks("UniqueName").Range.Text ActiveDocument.SaveAs2 FileName:="S:\FOLDER\" & UniqueFileName & ".pdf", FileFormat:=wdFormatPDF End Sub Thanks! *oddly, this macro won't run from my custom ribbon button; I have to select the macro via the Developer tab to get the macro to execute and save the file. Last edited by macropod; 05-13-2013 at 04:05 PM. Reason: Split from old thread & added code tags & formatting |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Individual numbers for pages | ewintrs | Word | 1 | 03-16-2013 12:46 PM |
Merge Word documents using a mailmerge field | Concertina | Mail Merge | 3 | 02-18-2013 04:12 AM |
![]() |
Baldeagle | Mail Merge | 8 | 02-11-2013 04:40 AM |
Individual Pop Up Alerts | vbmike73 | Outlook | 0 | 10-18-2012 06:33 AM |
![]() |
Baldeagle | Mail Merge | 13 | 05-29-2012 02:04 PM |