Error 6

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stan Lackey

    #1

    Error 6

    I have a VB6 program which prints several pages. While the last one is
    being printed, the page ejects before it's done, and the computer gets an
    Error 6 popup. It only seems to happen when using a networked printer, it
    works fine with a local printer. When the page ejects sometimes it's 1/4 or
    so done, sometimes 1/2, sometimes text looks like it's running off the page.
    Someone suggested I put a DOEVENTS right after the last page eject and I
    tried it but it had no effect. Help! -Stan

    Here's the structure:

    ...
    i = 1 ' start at first page
    Do
    <call to the routine that prints a page>
    Printer.EndDoc
    i = i+1
    If (i =18) Then Exit Sub ' keep going till last page is done
    Loop
    DoEvents
    End Sub


  • Mav

    #2
    Re: Error 6

    Some things I noticed:
    1) Is there a reason that you use a Do...Loop ? Why not use For...Next or
    While...Wend instead? Unless you have a special case, it would cut down on
    the amount of code you have to type.

    2) Use Printer.Newpage instead of Printer.EndDoc (unless you're on the last
    page)

    3) DoEvents is used inside of a Do...Loop, not outside.

    Just some thoughts...
    Josh


    Comment

    Working...