This is what I have so far:
Private Sub btnexport_Click()
Dim oWord As Object
Dim oWdoc As Object
Dim wdInputName As String
Dim wdOutputName As String
Dim outFileName As String
' Set Template Path
wdInputName = CurrentProject.Path & "\PDF Forms\Liability Certificates.docx"
' Create unique save filename with minutes
' and seconds to prevent overwrite
outFileName = "Liability_" & Format(Now(), "yyyymmddmms")
' Output File Path w/outFileName
wdOutputName = CurrentProject.Path & "\Split PDF" & outFileName
Set oWord = CreateObject("Word.Application")
Set oWdoc = oWord.Documents.Open(wdInputName)
' Start mail merge
With oWdoc.MailMerge
.MainDocumentType = 0 'wdFormLetters
.OpenDataSource _
Name:=CurrentProject.FullName, _
AddToRecentFiles:=False, _
LinkToSource:=True, _
Connection:="QUERY mailmerge", _
SQLStatement:="SELECT * FROM [mailmerge]"
.Destination = 0 'wdSendToNewDocument
.Execute Pause:=False
End With
' Hide Word During Merge
oWord.Visible = False
' Save file as PDF
' Uncomment the line below and comment out
' the line below "Save file as Word Document"
oWord.ActiveDocument.SaveAs2 wdOutputName & ".pdf", 17
' Save file as Word Document
'oWord.ActiveDocument.SaveAs2 wdOutputName & ".docx", 16
' Quit Word to Save Memory
oWord.Quit savechanges:=False
' Clean up memory
Set oWord = Nothing
Set oWdoc = Nothing
End Sub