Yes, we copied the code and changed the drives, attached this in case we have done something wrong (more than likely):
Private Sub Document_New()
' Demo code for a vba-driven mailmerge.
Dim wdApp As New Word.Application
Dim wdDoc As Word.Document
wdApp.DisplayAlerts = wdAlertsNone
Dim StrSrc As String, StrDoc As String
StrDoc = "J:\QLLetters\ASBL001.doc"
StrSrc = "H:\QL\ASBL001.csv"
Set wdDoc = wdApp.Documents.Open(StrDoc)
With wdDoc
With .MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource _
Name:=StrSrc, ReadOnly:=True, AddToRecentFiles:=False, LinkToSource:=False, _
Connection:="", SQLStatement:="", SQLStatement1:="", SubType:=wdMergeSubTypeOther
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
.MainDocumentType = wdNotAMergeDocument
End With
.Close False
End With
wdApp.DisplayAlerts = wdAlertsAll
End Sub
|