How to send HP printer escape codes from Excel?

G

Guest

Trying to select tray 2 on an HP 1200N ink jet printer from a VBA so each
page prints using the correct tray. I know the <esc> codes to send I just
don't know how to send them.
 
I

Ivan F Moala

I think something along the lines of


Code:
--------------------

Sub PrintLine()
Dim hdlTxt As Long

hdlTxt = FreeFile
'// Open the LPT1 port or Name of printer
Open "LPT1" For Output As #hdlTxt

'// Print command OR TEXT
Print #1, "THIS IS A TEST"

'// Close LPT1 port
Close #hdlTxt

End Sub
 
G

Guest

Ivan,
I am trying to use your code but I also am using a networked printer
identified as shown below and on PORT USB003. I tried using "USB003" for
"LPT1". It does not generate an error but nothing happens.

Application.ActivePrinter = "HP Business Inkjet 1200 Series on Ne02:"

Any other ideas

Thanks
 
G

Guest

Ivan,
I am trying to use your code but I also am using a networked printer
identified as shown below and on PORT USB003. I tried using "USB003" for
"LPT1". It does not generate an error but nothing happens.

Application.ActivePrinter = "HP Business Inkjet 1200 Series on Ne02:"

Any other ideas

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top