Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-14-2014, 09:47 PM
Legger Legger is offline Multiple page document to individual multiple page documents Windows XP Multiple page document to individual multiple page documents Office 2007
Novice
Multiple page document to individual multiple page documents
 
Join Date: Jun 2014
Posts: 2
Legger is on a distinguished road
Default Multiple page document to individual multiple page documents

Hello MSOffice Forums,
I'm stumped! Is there a way to use a multi-page Word doc to mail merge into many multi-page documents? For example, I have a 5 page document that I want to merge with 50 individual's information (a total of 9 fields per document) to create 50 individual documents of 5 pages each.
Thank you so much for helping me get this done and off my mind. It's driving me crazy!
Legger
Reply With Quote
  #2  
Old 06-14-2014, 10:37 PM
macropod's Avatar
macropod macropod is offline Multiple page document to individual multiple page documents Windows 7 32bit Multiple page document to individual multiple page documents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Word's built-in mailmerge tools will allow you to create a single document containing all 5 pages for each record. To create a separate file for each record, you'll need a macro.

The following macro generates one output file per record. Files are saved to the same folder as the mailmerge main document, using the ‘Last_Name’ & ‘First_Name’ fields in the data source for the filenames. PDF & DOCX formats are catered for.
Code:
Sub Merge_To_Individual_Files()
'Merges one record at a time to the chosen output folder
Application.ScreenUpdating = False
Dim StrFolder As String, StrName As String, MainDoc As Document, i As Long, j as long
Set MainDoc = ActiveDocument
With MainDoc
  StrFolder = .Path & Application.PathSeparator
  For i = 1 To .MailMerge.DataSource.RecordCount
    With .MailMerge
      .Destination = wdSendToNewDocument
      .SuppressBlankLines = True
      With .DataSource
        .FirstRecord = i
        .LastRecord = i
        .ActiveRecord = i
        If Trim(.DataFields("Last_Name")) = "" Then Exit For
        StrName = .DataFields("Last_Name") & "_" & .DataFields("First_Name")
      End With
      .Execute Pause:=False
    End With
    StrName = Trim(StrName)
    With ActiveDocument
      .SaveAs2 FileName:=StrPath & StrName & ".docx", FileFormat:=wdFormatXMLDocument, AddToRecentFiles:=False
      ' and/or:
      .SaveAs2 FileName:=StrPath & StrName & ".pdf", FileFormat:=wdFormatPDF, AddToRecentFiles:=False
      .Close SaveChanges:=False
    End With
  Next i
End With
Application.ScreenUpdating = True
End Sub
For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 06-15-2014, 05:55 AM
Legger Legger is offline Multiple page document to individual multiple page documents Windows XP Multiple page document to individual multiple page documents Office 2007
Novice
Multiple page document to individual multiple page documents
 
Join Date: Jun 2014
Posts: 2
Legger is on a distinguished road
Default How to insert macro

Hi Paul,
Thanks for the quick reply. This looks great! Now, I'm going to learn how to record a macro.
Cheers
Legger
Reply With Quote
  #4  
Old 06-15-2014, 06:36 AM
macropod's Avatar
macropod macropod is offline Multiple page document to individual multiple page documents Windows 7 32bit Multiple page document to individual multiple page documents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Macro recording isn't involved. All you need do is install, edit the ‘Last_Name’ & ‘First_Name’ references, if necessary to match your data, then run it.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple page document to individual multiple page documents Used RD for TOC for multiple docs. Now all show page 1. Dart82 Word 4 05-06-2014 11:23 PM
Multiple records on the same page Hugh Mail Merge 2 04-04-2014 05:24 PM
2 page document printing problem, text from page 1 in layout of page 2 when printed laurawether45 Word 1 08-02-2012 07:03 AM
Consecutive page numbers on multiple documents georgeeasten Word 1 02-10-2011 02:12 AM
Multiple page document to individual multiple page documents page numbering across multiple documents reitdesign Word 3 12-12-2008 11:55 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:01 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