Results 1 to 9 of 9

Thread: [RESOLVED] VB6 program cannot print from certain computers (suddenly), works fine elsewhere

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Iowa
    Posts
    73

    Resolved [RESOLVED] VB6 program cannot print from certain computers (suddenly), works fine elsewhere

    I have an old VB6 app I wrote back when we first switched to XP. Within the last year or 2, we switched to win7. We've been using it without issues on about 30 different computers. Overnight, it stopped working on a specific computer. Reinstalled the printer (it's just a Generic/Text printer driver - zebra barcode printer) and still no luck. They started printing from a computer beside it to get stuff down. Now, about 3 weeks later, this other computer can no longer print to this printer. The job doesn't even show up in the queue. Both computers print to other printers just fine. They also cannot print to another zebra printer in a different lab.

    It's a corporate environment, all computers are the same models and windows builds. All updates are remotely pushed by IT.

    Here's a simplified version of the code.

    Code:
    Set Printer = Printers(lstPrinters.ListIndex)
    Printer.Print "^someZPLcode"
    Printer.Print "^moreZPLcode"
    Printer.Print "^lastZPLcode"
    Printer.EndDoc
    As stated, it still works fine from all of the other computers, but the 2 that it's not working on seem to be the most dependent on the software.

    There's no error and it doesn't show up in the printer queue. Any suggestions would be great.

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: VB6 program cannot print from certain computers (suddenly), works fine elsewhere

    Can you print to the zebra printer on these trouble pcs from notepad?

  3. #3
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: VB6 program cannot print from certain computers (suddenly), works fine elsewhere

    Look at How To Send Raw Data to a Printer Using the Win32 API from Visual Basic and other similar MS KB articles if you insist on doing this instead of using a proper printer driver.

    What you are doing now probably only works (when it works) by sheer luck.

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: VB6 program cannot print from certain computers (suddenly), works fine elsewhere

    No, there is nothing lucky about it. ZPL is plain text and the plain text driver works beautifully for it. I've never ran into an issue in the 10+ years I have been using that method for ZPL and EPL enabled devices. In fact this method is actually better than using the printer specific drivers as the data sent to the printer is smaller and the print quality is higher in most cases. I have tried the native drivers but the resulting barcodes are harder to read and the data packets sent to the printer are 10x-100x larger than when using plain text ZPL. So the result is that using the plain text driver and ZPL code gives you better looking labels that are easier to scan and print faster.

    As to the problem of the OP I would first try to paste some ZPL into notepad and try to print it to the printer using that generic driver and see what happens. If nothing prints then I would uninstall and reinstall the driver and try it again.

    Are the other computers that are working properly using the same physical Zebra printer? If not then it could be something related to the printer settings but that would not apply if other computers can printer correctly using that same printer.

    Another possibility if you have the Zebra driver installed on the troublesome PC would be that somehow some setting got changed and is causing a problem though I can't think of a way this could happen and not affect any other computers that share the printer, still could be possible.
    Last edited by DataMiser; Apr 27th, 2015 at 08:23 PM.

  5. #5
    Addicted Member
    Join Date
    Apr 2015
    Location
    Connecticut, USA
    Posts
    147

    Re: VB6 program cannot print from certain computers (suddenly), works fine elsewhere

    I've seen stuff like this with Zebras before, especially if the printer is used with another application like LabelView on the same computer. Reinstalling the driver sometimes works, and setting the PC's default printer to be the Zebra also sometimes works.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Iowa
    Posts
    73

    Re: VB6 program cannot print from certain computers (suddenly), works fine elsewhere

    Quote Originally Posted by DataMiser View Post
    Can you print to the zebra printer on these trouble pcs from notepad?
    Yes, printing from notepad works fine.

    Also, no other zebra printing applications are installed on these computers. We only have 2 barcode printers and all of our computers print to these. In fact, these printers have never had the zebra driver installed since we've owned them, they've always just been the Generic/Text Only driver.
    Last edited by sdouble; Apr 28th, 2015 at 08:39 AM. Reason: rewording

  7. #7
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: VB6 program cannot print from certain computers (suddenly), works fine elsewhere

    Quote Originally Posted by DataMiser View Post
    No, there is nothing lucky about it. ZPL is plain text and the plain text driver works beautifully for it. I've never ran into an issue in the 10+ years I have been using that method for ZPL and EPL enabled devices.
    And yet we see this very same problem posted over and over again, and the fix is always to do raw printing instead of going through the text driver.

  8. #8
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: VB6 program cannot print from certain computers (suddenly), works fine elsewhere

    hmm.. Is it possible that this line of code
    Set Printer = Printers(lstPrinters.ListIndex)

    Is not setting the printer to what it should?

    If you have the IDE on that machine then I would suggest stepping through the code and/or adding some debug.print statements.
    If no IDE then you may want to add some logging or msgbox there and have it show the name of the printer it has selected.
    You may also want to have it dump the full ZPL to a file and have a look at it and then try to print that from notepad.

    Basically if it works from notepad then it should be working from your program.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Iowa
    Posts
    73

    Re: VB6 program cannot print from certain computers (suddenly), works fine elsewhere

    Honestly, I fixed it by just doing the following.

    Code:
    Set Printer = Printers(lstPrinters.ListIndex)
    Open Printer.DeviceName for Output As #1
    Print #1, "^someZPLcode"
    Print #1, "^moreZPLcode"
    Print #1, "^lastZPLcode"
    Close #1
    I'm planning on re-writing it at some point, but will be a much larger application. This is getting us by until that happens, so far.

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width