This Word VBA code which runs correctly:
Sub Macro2()
Documents.Open Filename:="testing.docx", AddToRecentFiles:=False
strSourceDoc = ActiveDocument.Path & "" & "fixedcharge.xls"
ActiveDocument.MailMerge.OpenDataSource Name:=strSourceDoc,Format:=wdOpenFormatAuto, Connection:= "Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;Data Source=" & _
strSourceDoc & ";Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";" & _
"Jet OLEDB:System database="""";Je", _
SQLStatement:="SELECT * FROM ''Sheet$1''", SQLStatement1:="", _
SubType:=wdMergeSubTypeAccess
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = ActiveDocument.MailMerge.DataSource.ActiveRecord
.LastRecord = ActiveDocument.MailMerge.DataSource.ActiveRecord
End With
.Execute Pause:=False
End With
End Sub
My problem is that my Excel sheet has more than one record. When a Word document is saved to "SOW1.docx", only one record is saved.