+ Reply to Thread
Results 1 to 3 of 3

excel vba word merge printer error

Hybrid View

  1. #1
    mcarey101@qwest.net
    Guest

    excel vba word merge printer error

    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


  2. #2
    NickHK
    Guest

    Re: excel vba word merge printer error

    You'd probably have more luck in a Word NG, but...
    Does this code work properly if run from Word ?
    Do you get any help if you change the Pause to True ?
    What if .Destination=wdSendToNewDocument ?

    NickHK

    <mcarey101@qwest.net> wrote in message
    news:1152075276.227986.151900@j8g2000cwa.googlegroups.com...
    > 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
    >




  3. #3
    mcarey101@qwest.net
    Guest

    Re: excel vba word merge printer error

    This same thing happens when I try to print Excel documents using VBA
    macros, so it is not a Word specifc issue. When a document gets to a
    certain size, it seems to cause this error. But this only happens is
    VBA is doing the printing- if I have the maco send the output to a
    file, then print that file directly from Excel or Word, it prints fine.


    NickHK wrote:
    > You'd probably have more luck in a Word NG, but...
    > Does this code work properly if run from Word ?
    > Do you get any help if you change the Pause to True ?
    > What if .Destination=wdSendToNewDocument ?
    >
    > NickHK
    >
    > <mcarey101@qwest.net> wrote in message
    > news:1152075276.227986.151900@j8g2000cwa.googlegroups.com...
    > > 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
    > >



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1