aziz rasul
Active member
- Local time
- Today, 11:41
- Joined
- Jun 26, 2000
- Messages
- 1,935
I have the following snippet of code which print mail merge MS Word documents: -
The problem is that the Word file prints alternately i.e. each other time? Can anyone understand why. Is it a memory problem?
It fails at the line
With ActiveDocument.MailMerge
Code:
strDestinationFile1 = CurrentProject.Path & "\Letters\Letter template 12 - Invitation to Cookwell Group.doc"
Set objWord = New Word.Application
objWord.Visible = True
Set objDoc1 = objWord.Documents.Open(strDestinationFile1)
objWord.ActiveDocument.MailMerge.OpenDataSource Name:=CurrentProject.Path & "\Sandwell PCT Front End.mdb", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=CurrentProject.Path & \Sandwell PCT Front End.mdb;Mode=Read;Extended Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:E" _
, SQLStatement:="SELECT * FROM `qryLetter11`", SQLStatement1:="", SubType:=wdMergeSubTypeAccess
objWord.ActiveDocument.MailMerge.ViewMailMergeFieldCodes = wdToggle
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
objDoc1.Close False
objWord.Quit False
Set objWord = Nothing
Set objDoc1 = Nothing
The problem is that the Word file prints alternately i.e. each other time? Can anyone understand why. Is it a memory problem?
It fails at the line
With ActiveDocument.MailMerge
Last edited: