Q: How to send PCL commands to a printer from VBA 
Author Message
 Q: How to send PCL commands to a printer from VBA

I need to send PCL commands to a printer to select the right papertray (in
VBA in Word 2000). I found out the right commands (starting with the escape
character), but I can't seem to figure out how to send this command to the
printer. I was told that when I type the command in the text of the Word
2000 document it should even work. Because the printer recognizes it as a
PCL command (by the escape character). Well, this won't work because the
command is interpreted and printed as normal text.

Where can I find information how to do this?

Thanks in advance, Tim



Wed, 07 Apr 2004 05:00:22 GMT  
 Q: How to send PCL commands to a printer from VBA
Start help, go to the index, have it search for this:

Field codes: print

Persevere.  Piece of cake to find it in Word 97 if you've got that instead
... you're looking for Print Field Codes - fields that let you plug in info
that'll be passed directly to the printer at print time.

And ... well, neat! ... the macro recorder will do the heavy lifting for
you.  Start it, then:

Insert, Field
Click Document Automation in Categories list
Click Print in Field names list
(Word fills in PRINT for you in the text box below)
Add whatever you need to add to the print field
OK
Stop the recorder and have look at what it hath wrought.

--
Steve Rindsberg, PowerPoint MVP
Got a PowerPoint wish/suggestion/beef?

Get the PPT FAQs at http://www.rdpslides.com/pptfaq/
RnR PPTools - http://www.rdpslides.com/pptools/
------

Quote:
> I need to send PCL commands to a printer to select the right papertray (in
> VBA in Word 2000). I found out the right commands (starting with the
escape
> character), but I can't seem to figure out how to send this command to the
> printer. I was told that when I type the command in the text of the Word
> 2000 document it should even work. Because the printer recognizes it as a
> PCL command (by the escape character). Well, this won't work because the
> command is interpreted and printed as normal text.

> Where can I find information how to do this?

> Thanks in advance, Tim



Tue, 06 Apr 2004 22:00:21 GMT  
 Q: How to send PCL commands to a printer from VBA
Steve, thanks for your reply.

I tried your suggestion (I even found some documentation in the knowledge

base from Microsoft). I put the following code in the field:

{PRINT 027"&l2X"}

What I'm not sure of is whether I should type '027' as the escape code or

chr(27) or maybe nothing. When I try to print a document with the above code

in it, it won't print at all. And it should print twice (that's what the

code is for). I own a Xerox printer which should understand PCL codes, but

I'm wondering if it really does.

Any suggestions?


Quote:
> Start help, go to the index, have it search for this:

> Field codes: print



Fri, 09 Apr 2004 06:52:44 GMT  
 Q: How to send PCL commands to a printer from VBA
you should use chr(27) that's the escape char telling the printer that some
control char is on the way

printer.print chr(27) & blah


Quote:
> Steve, thanks for your reply.

> I tried your suggestion (I even found some documentation in the knowledge

> base from Microsoft). I put the following code in the field:

> {PRINT 027"&l2X"}

> What I'm not sure of is whether I should type '027' as the escape code or

> chr(27) or maybe nothing. When I try to print a document with the above
code

> in it, it won't print at all. And it should print twice (that's what the

> code is for). I own a Xerox printer which should understand PCL codes, but

> I'm wondering if it really does.

> Any suggestions?



> > Start help, go to the index, have it search for this:

> > Field codes: print



Fri, 09 Apr 2004 05:42:26 GMT  
 Q: How to send PCL commands to a printer from VBA

Quote:
>I put the following code in the field:

> {PRINT 027"&l2X"}

But you mentioned wanting to do it in VBA.  If you record a macro while you
create a print field containing just "1234" you get (in part) something like
this:

Text:="PRINT 1234"

I'd bet that you'll get what you want if you were to change that to

Text:="PRINT" & " " & chr$(27) & "&l2X"

(watch the diff between 1 - one - and l - lowercase ell - in those PCL
commands, btw.)



Fri, 09 Apr 2004 23:57:08 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. How To Send Printer PCL Commands?

2. Sending escape sequences to PCL printer ??

3. Sending PCL 5e Escape Characters to the Printer

4. Send PCL command

5. Sending HPGL files to a PCL printer

6. Help, How to send printer command to printer bypassing printer driver in vb

7. how to send printer commands to a printer

8. Sending Printer Commands to Printer using QBASIC

9. Need to send a command directly to printer (Eltron Card Printer)

10. send command to printer port

11. sending printer commands?

12. How can I send commands to a printer???

 

 
Powered by phpBB® Forum Software