Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Barcodes using VB application

Status
Not open for further replies.

tmreic

Technical User
Feb 18, 2003
18
US
Hi,

I am currently trying to write a small VB application to print barcodes on a zebra 90xiII printer. Currently, the printers is hooked up to a computer and shared via the network. My VB application allows me to select the printer from the network and print out labels. The problem occurrs when i want use the zebra resident fonts to generate the barcode symbology. When i switch the fontname to ZB 128* 7mil and run my code. The font is defaulted back to arial. Any ideas why this happens. Additional, if i go into excel and set the font to ZB 128* 7mil and print from excel i get the a barcode with the correct symbology. Any ideas? My code that i am using is below.

Thanks,
Tmreic


Private Sub Form_Load()
Dim P As Printer

For Each P In Printers
Combo1.AddItem P.DeviceName
Next P
Combo1.Text = Combo1.List(0)
End Sub

Private Sub cmdPrint_Click()
Dim variable As String
variable = Me.txtBarcode


If Combo1.Text <> &quot;&quot; Then
Dim P As Object
For Each P In Printers
If P.DeviceName Like &quot;*&quot; & Combo1.Text & &quot;*&quot; Then
Set Printer = P
'MsgBox Combo1.Text & &quot; is now the Default Printer&quot;
Exit For
End If
Next P
Else
MsgBox &quot;You did not select a printer&quot;
Exit Sub

End If


Printer.Font.Name = &quot;ZB 128B* 7 mil&quot; ' barcode font
Printer.FontSize = 36 'Use this font for 1/4&quot; inch lbl
Printer.CurrentY = 10
Printer.Print variable;

Printer.Font.Name = &quot;Zebra Font A&quot;

MsgBox Printer.Font.Name
Printer.FontSize = 8

Dim HFONT
HFONT = Me.txtBarcode_Read

Printer.Print Spc(2); HFONT
Printer.EndDoc 'This tells the printer to eject the page

End Sub



Private Sub cmdExit_Click()
End
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top