M
mcarey101
I have an Excel vba macro that does a Word mail merge. If the
resulting document gets over a few pages in size, the printer prints
some of the pages, then throws out an error page that is pretty
meaningless dump of junk and stops printing. (I am guess it is from
some sort of over run of data in the buffer ?). If I modify the vba
code to send the resulting document to a new Word document, then print
that document from Word, it prints just fine.
Any idea why this happens? Does this method of printing do something
different than printing right from Word ?
Here is the code:
Dim oWord As Word.Application
Dim oMainDoc As Word.Document
Dim oOutputDoc As Word.Document
Dim omm As Word.MailMerge
Set oWord = CreateObject("Word.Application")
Set oDoc = oWord.Documents.Open("p:\carbboom online
system\onlineorders.doc")
Set omm = oDoc.MailMerge
With omm
.DataSource.FirstRecord = wddefaultfirstrecord
.DataSource.LastRecord = wdDefaultLastRecord
.Destination = wdSendToPrinter
.Execute Pause:=False
End With
Set oOutputDoc = Nothing
Set omm = Nothing
oDoc.Close
Set oDoc = Nothing
oWord.Quit
Set oWord = Nothing
resulting document gets over a few pages in size, the printer prints
some of the pages, then throws out an error page that is pretty
meaningless dump of junk and stops printing. (I am guess it is from
some sort of over run of data in the buffer ?). If I modify the vba
code to send the resulting document to a new Word document, then print
that document from Word, it prints just fine.
Any idea why this happens? Does this method of printing do something
different than printing right from Word ?
Here is the code:
Dim oWord As Word.Application
Dim oMainDoc As Word.Document
Dim oOutputDoc As Word.Document
Dim omm As Word.MailMerge
Set oWord = CreateObject("Word.Application")
Set oDoc = oWord.Documents.Open("p:\carbboom online
system\onlineorders.doc")
Set omm = oDoc.MailMerge
With omm
.DataSource.FirstRecord = wddefaultfirstrecord
.DataSource.LastRecord = wdDefaultLastRecord
.Destination = wdSendToPrinter
.Execute Pause:=False
End With
Set oOutputDoc = Nothing
Set omm = Nothing
oDoc.Close
Set oDoc = Nothing
oWord.Quit
Set oWord = Nothing