We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How do I send a ZPL string to a named printer in Excel VBA to print a label?

David St. John
on
Medium Priority
5,978 Views
Last Modified: 2012-05-11
I have an Excel worksheet with a Print Label button. I need to send a ZPL string to a Zebra network printer. The printer is a named printer on the computer. I have to change from the default printer, send the ZPL string to print the label and change back to the default printer.

How do I send the ZPL string to the named printer in Excel VBA to print a label and select the printer?
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2008
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2008

Commented:
Looks like some Zebra printer code can be found here. No idea if it actually works because I don't have a printer. VB6 is essentially the same as VBA.

Title: vb6, ZPL, socket printing
Link: http://stackoverflow.com/questions/3396656/vb6-zpl-socket-printing

Kevin
David St. JohnIT Manager

Author

Commented:
Kevin,

The first code did set the printer to the correct printer. How do I send the ZPL string to that printer?

Thanks,
David
CERTIFIED EXPERT
Top Expert 2008

Commented:
See the link I provided in my second post. There are some VB6 code examples which should transfer unedited to your VBA project.

Kevin
CERTIFIED EXPERT
Top Expert 2008

Commented:
Another promising link. You have to open the printer in raw data mode to the printer’s queue. Note the link to the Microsoft site for the actual code. The article discusses how to use it with a fix for the Windows SDK call.

Title: Sending ZPL to a Zebra Printer via Visual Basic 2005
Link: http://blog.darrellittle.com/?p=9

Kevin
David St. JohnIT Manager

Author

Commented:
I used your code above to make sure I had the correct printer and then I used additional code off the internet to send the text string to the Zebra printer. Thanks.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.