Hi,
Can any one help enhance the code below to
1. send the result of the mailmerge to pdf
2. Save the results to a specific location
Regards,
Chris
Can any one help enhance the code below to
1. send the result of the mailmerge to pdf
2. Save the results to a specific location
Private Sub LFD10_letter()
Dim oMainDoc As Word.Document
Dim oSel As Word.Selection
Dim sDBPath As String
Set oMainDoc = oApp.Documents.Open("C:\Documents and Settings\Chris\Desktop\Letter_Access\60D")
'oApp.Documents.Open ("C:\Documents and Settings\Chris\Desktop\Letter_Access\60D")
oApp.Visible = True 'set connection as visible
With oMainDoc.MailMerge
.MainDocumentType = wdFormLetters
sDBPath = "C:\Documents and Settings\Chris\My Documents\db2.mdb"
.OpenDataSource Name:=sDBPath, _
SQLStatement:="SELECT * FROM `" & "LFD10" & "`", SQLStatement1:="" 'link to data source
End With
With oMainDoc
.MailMerge.Destination = wdSendToNewDocument
.MailMerge.Execute
' .Save (Format(Date, "mmddyyyy"))
.Save
End With
oApp.Activate
oApp.Documents.Parent.Visible = True
oApp.Application.WindowState = 1
oApp.ActiveWindow.WindowState = 1
oMainDoc.Close (0)
End Sub
Regards,
Chris