Printing variable with VBA to labelprinter for barcodes

R

Ronald Spierings

Hello all,

I want to send a string directly to a printer out of a VBA module. The
printer is a Zebra labelprinter and i have to sent several codes to build up
a barcode to print.
I already created a vaiable which contains all codes and information to
build up the barcode. It is my problem not knowing the correct VBA codes to
send the contents of the variable directly to my printer which is connected
at COM1.

Please who could help me to get this working
 
T

Tim Ferguson

=?Utf-8?B?Um9uYWxkIFNwaWVyaW5ncw==?=
I already created a vaiable which contains all codes and information
to build up the barcode. It is my problem not knowing the correct VBA
codes to send the contents of the variable directly to my printer
which is connected at COM1.


These may help a bit:

http://www.vbforums.com/showthread.php?t=398578&highlight=mscomm

(ignore the stuff about modems and fax; the output to the comm port is
the bit that matters to you)

http://www.yes-tele.com/mscomm.html




Hope that helps


Tim F
 
R

Ronald de Rosa Spierings

Thanks for the answer, but it does not work.

I get an error: "Object required" at the row "comOne.commport = 1"

It seems a command is missing to initialise comOne as an object.
 
T

Tim Ferguson

I get an error: "Object required" at the row "comOne.commport = 1"

It seems a command is missing to initialise comOne as an object.

How did you instantiate it?

Dim comOne As New MSCommLib.MSComm
With comOne
.CommPort = 2
.Settings = "9600,N,8,1"
.PortOpen = True
.Output = "Hello, World" & vbCr

End With

This code appears to compile and runs through, although I don't have
anything on the end of COM2: to test it with.

Actually putting a control on the form seems to work, but I can't see all
its properties in Intellisense, so something fishy might be going on
there.

Best of luck!


Tim F
 

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