#1
|
|||
|
|||
Split a 500 page merge into about 23 documents
I've read and tested the suggested split but they seem to be designed to split into individual docs, I've got about 500 labels and they're a bit unwieldy as a single document, they'd be best split into each location (roughly 23) which can be determined each time that location field changes, which would also be the file name, is anyone able to help? Thanks Last edited by documentimpossible; 02-16-2024 at 02:31 AM. |
#2
|
|||
|
|||
I've just confirmed the addins that say [many to one] don't work for my use case either they seem to be designed to put multiple merge records into a single page or table, I've got a small label entirely filled by it's own data on a table, I want 20 label pages per document
|
#3
|
|||
|
|||
Figured it out for anyone else passing through - thanks to Macropod over at MrExcel - this is his code suggestion with a chunk of my bodge around it to select a range to output on the merge rather than a single
Code:
Sub MergeToSplitLine() '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, istart As Long, thisSet As String Set MainDoc = ActiveDocument With MainDoc StrFolder = .Path & "\" .MailMerge.DataSource.ActiveRecord = 1 thisSet = .MailMerge.DataSource.DataFields("Line").Value StrName = thisSet & " _ " & .MailMerge.DataSource.DataFields("Part") istart = 1 'MsgBox "start" For i = 1 To .MailMerge.DataSource.RecordCount If i < .MailMerge.DataSource.RecordCount Then .MailMerge.DataSource.ActiveRecord = i + 1 If thisSet = .MailMerge.DataSource.DataFields("Line").Value Then GoTo skipOutput End If End If With .MailMerge .Destination = wdSendToNewDocument .SuppressBlankLines = True With .DataSource .FirstRecord = istart .LastRecord = i End With .Execute Pause:=False End With With ActiveDocument .SaveAs2 FileName:=StrFolder & StrName & ".docx", FileFormat:=wdFormatXMLDocument, AddToRecentFiles:=False .Close SaveChanges:=False End With If i < .MailMerge.DataSource.RecordCount Then istart = i + 1 .MailMerge.DataSource.ActiveRecord = i + 1 thisSet = .MailMerge.DataSource.DataFields("Line").Value StrName = thisSet & " _ " & .MailMerge.DataSource.DataFields("Part") End If skipOutput: DoEvents Next i End With Application.ScreenUpdating = True |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to Split Documents | Gingerbreadgrl | Word VBA | 4 | 09-02-2019 03:18 PM |
Mail Merge - split merged documents and rename each split document based on text in header | FuriousD | Word VBA | 1 | 05-12-2019 04:06 AM |
Help Please: New VBA user trying to use a macro to split Mail Merge documents. Two Run-Time Error | zipit189 | Word VBA | 7 | 03-18-2015 01:13 PM |
Split each page of mail merge into separate pdf | Declan | Mail Merge | 1 | 05-28-2014 02:02 AM |
Split multi-page mail merge document, then name file from letter info. | BriMan83 | Mail Merge | 1 | 04-24-2013 11:35 PM |