Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-13-2013, 02:23 PM
DaddyMac DaddyMac is offline Mailmerge Individual Documents Windows 7 32bit Mailmerge Individual Documents Office 2010 32bit
Novice
Mailmerge Individual Documents
 
Join Date: May 2013
Posts: 3
DaddyMac is on a distinguished road
Default Mailmerge Individual Documents

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
Any advice or guidance will be greatly appreciated!



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
Reply With Quote
  #2  
Old 05-13-2013, 04:09 PM
macropod's Avatar
macropod macropod is offline Mailmerge Individual Documents Windows 7 64bit Mailmerge Individual Documents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi DaddyMac,

The problem with trying to work from mailmerge previews is that, once you get beyond outputting fields that don't require any in-document processing, the preview cannot be relied on to generate the same output as finishing the merge.

For a comprehensive solution, see: http://www.gmayor.com/individual_merge_letters.htm
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 06-06-2013, 04:23 PM
DaddyMac DaddyMac is offline Mailmerge Individual Documents Windows 7 32bit Mailmerge Individual Documents Office 2010 32bit
Novice
Mailmerge Individual Documents
 
Join Date: May 2013
Posts: 3
DaddyMac is on a distinguished road
Default

Thanks so much for the reply and my apologies for not following up sooner (was down and out for a couple weeks due to illness).

I will study the link you shared - it appears that his download would most likely work but, given my hardheadedness, I may study some of the code he includes on the page to see if I can learn as well.

Since my previous post I changed my data source from Outlook to Excel and have a formula in Excel which generates a unique filename, which I in turn include as a mergefield in my Word doc. I'm playing around with having that field in the footer and trying to see if I can split the merged document into separate documents using the footer as a trigger, then saving each one with the merged field text in the footer as the filename.

Appreciate the guidance!!
Reply With Quote
  #4  
Old 06-06-2013, 07:43 PM
macropod's Avatar
macropod macropod is offline Mailmerge Individual Documents Windows 7 32bit Mailmerge Individual Documents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For what you're trying to do with the footers, I don't think the addin will work. I haven't tried it, but that's not how I believe it's designed to work. In that case, you'd need to work with one of the other macros. If you contact the owner of that site, he may be able to help you - I'm not able to do so as I'll be away with only limited internet access over the coming months.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 06-06-2013, 09:22 PM
DaddyMac DaddyMac is offline Mailmerge Individual Documents Windows 7 32bit Mailmerge Individual Documents Office 2010 32bit
Novice
Mailmerge Individual Documents
 
Join Date: May 2013
Posts: 3
DaddyMac is on a distinguished road
Default

Many thanks! Coincidentally I just finished reading a post of yours over at ExcelForum.

I'm hoping to use the concept of the "Splitter" macro to split pages based on the unique value in either the footer of each page or, e.g., a table cell (where I had it previously), and then save each new document based on that value using a variation of the code in my first post.

I'm certain it's easier said than done...
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
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
Mailmerge Individual Documents Mailmerge to Email with a mailmerge attachment Baldeagle Mail Merge 8 02-11-2013 04:40 AM
Individual Pop Up Alerts vbmike73 Outlook 0 10-18-2012 06:33 AM
Mailmerge Individual Documents Mailmerge to Email with a mailmerge attachment Baldeagle Mail Merge 13 05-29-2012 02:04 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:04 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft