Printing to network printers from VBA Code

D

Dave Johnson

I'm triing to send printer command code (ZPL) to a printer
from Access 2000 Form Using VBA code

The following code snippet works OK.

Open "LPT1:" For Output As #1
Print #1, Head; LabelData; Foot
Close #1

But the printer port I require to print to is
IP_10.0.0.128 2
A printer connected to an HP Jetdirect 3 port print server.

I'v tried "IP_10.0.0.128 2:" with and without the colon
Ether nothing happens or I get Bad filename or Number error

Many Thanks in advance for any help on this
 
M

Michel Walsh

Hi,


You may use a socket to speak through the Ethernet cable. Open is useful
for file (including serial port and parallel port).


Hoping it may help,
Vanderghast, Access MVP
 
R

Ron Weiner

Dave

Have you tried to use the Net Use command? Might work for you. Try this
from the command prompt.

Net Use LPT1: \\10.0.0.128 <Enter>

This assumes that your printer is shared at that IP address by the Jet
Direct adapter. If this command is successful then your code

Open "LPT1:" For Output As #1
Print #1, Head; LabelData; Foot
Close #1

should work!

If it does then you could issue a

Net Use LPT1: \\10.0.0.128 /persistent:YES

In order to make this connection on all subsequent reboots. Let us know how
it all works out.

Ron W
 
Top