![]() |
|
#2
|
||||
|
||||
|
Can you adapt this looping code to fit your requirements? Start by testing it by itself before you start adding your extra code. It appears you have code included in your sample which may not be required with this approach.
Code:
Public Sub Merge_To_Individual_Files()
Dim StrFolder As String, MainDoc As Document, i As Long
Set MainDoc = ActiveDocument
StrFolder = MainDoc.Path & "\"
With MainDoc.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
.ViewMailMergeFieldCodes = False
With .DataSource
.ActiveRecord = wdFirstRecord
Do Until i = .ActiveRecord 'next record didn't go forward
MainDoc.SaveAs FileName:=StrFolder & i & "temp.pdf", FileFormat:=wdFormatPDF, AddToRecentFiles:=False
i = .ActiveRecord
.ActiveRecord = wdNextRecord
Loop
End With
End With
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Show total number of records mailmerge
|
eduzs | Mail Merge | 1 | 11-24-2020 09:04 PM |
Save mailmerge records as individual word files using VBA
|
beefcake2000 | Word VBA | 3 | 11-10-2017 09:55 PM |
When using a 'Master' template, if number of records change, subsequent records will not be read
|
MailMergeConfused | Mail Merge | 5 | 07-28-2016 05:07 PM |
Mailmerge - when some records have photos, and some without
|
smitty777 | Mail Merge | 3 | 05-20-2016 08:30 PM |
Missing records after word mailmerge
|
matthewchin | Mail Merge | 18 | 12-11-2015 12:06 AM |