I found the code below on this page:
http://www.mrexcel.com/forum/genera...010-mail-merge-save-individual-pdf-files.html
It appears a number of people in the thread have used it successfully, however ... in my case, absolutely nothing happens.
No errors etc. and it doesn't create any PDFs at all.
I tried changing StrName to just "test" ... to make sure that wasn't causing problems, but it still won't create a single PDF.
Just to confirm, I am trying to run the code in my main mailmerge document i.e. i have not used 'Finish & Merge' and the document contains 72 'results' / recipients.
Any help would be much appreciated.
http://www.mrexcel.com/forum/genera...010-mail-merge-save-individual-pdf-files.html
It appears a number of people in the thread have used it successfully, however ... in my case, absolutely nothing happens.
No errors etc. and it doesn't create any PDFs at all.
I tried changing StrName to just "test" ... to make sure that wasn't causing problems, but it still won't create a single PDF.
Just to confirm, I am trying to run the code in my main mailmerge document i.e. i have not used 'Finish & Merge' and the document contains 72 'results' / recipients.
Any help would be much appreciated.
Code:
Sub merge1record()
Application.ScreenUpdating = False
Dim StrPath As String, StrName As String, MainDoc As Document
StrPath = "C:\CENTRAL OPS\Pack\PDF Files\"
Application.ScreenUpdating = False
Set MainDoc = ActiveDocument
With MainDoc
For i = 1 To .MailMerge.DataSource.RecordCount
With .MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = i
.LastRecord = i
.ActiveRecord = i
StrName = .DataFields("Name")
End With
.Execute Pause:=False
End With
With ActiveDocument
.ExportAsFixedFormat OutputFileName:=StrPath & StrName & ".pdf", ExportFormat:=wdExportFormatPDF, _
OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:=wdExportAllDocument, _
Item:=wdExportDocumentContent, IncludeDocProps:=True, CreateBookmarks:=wdExportCreateNoBookmarks, _
KeepIRM:=True, DocStructureTags:=True, BitmapMissingFonts:=True, UseISO19005_1:=False
End With
Next i
End With
Application.ScreenUpdating = True
End Sub