View Single Post
 
Old 08-08-2014, 04:36 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,383
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

If you bookmark the field you want to use for the filename with the name 'Name', you could use a macro like the following. Simply preview the record to be output, then run the macro. The output file is saved to the same folder as the mailmerge main document.
Code:
Sub Demo()
Dim StrPath As String, StrName As String
With ActiveDocument
  StrPath = .Path & "\"
  StrName = .Bookmarks("Name").Range.Text  .SaveAs2 FileName:=StrPath & StrName & ".pdf", FileFormat:=wdFormatPDF, AddToRecentFiles:=False
End With
End Sub
Note: Given that previews don't reliably display the results in the way finishing the merge does when you're using much more than simple mergefields, this may not be a suitable solution. If not, a different approach will be required. Try it, though, and see if it produces the desired results.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]

Last edited by macropod; 08-08-2014 at 04:39 PM. Reason: Simplified macro
Reply With Quote