RGuillermo
asked on
how to get rid of the blank label after printing
Hello Experts,
We are trying to print labels from an old application still working.
We used vb6 and vfp9, to develop a very small routine,
but both modules after printing always print a blank label.
How can we stop this blank label from being printed ??
Regards!
We are trying to print labels from an old application still working.
We used vb6 and vfp9, to develop a very small routine,
but both modules after printing always print a blank label.
How can we stop this blank label from being printed ??
Regards!
Can you post the VB6 routine that you are using?
ASKER
Martin Liss,
Here you have my code in vb6
'Snippet from the printing routine that demonstrates switching font from barcode to courier font...
Here you have my code in vb6
Private Sub Command1_Click()
Snippet
End Sub
Private Sub Form_Load()
For i = 0 To Printers.Count - 1
' if the specified printer is found select it
If InStr(UCase(Printers(i).DeviceName), "ZEBRA") > 0 Then
Set Printer = Printers(i)
SelectPrinter = True
Exit For
End If
Next i
If Not SelectPrinter Then
MsgBox "Unable to find Zebra printer ", vbOKOnly + vbExclamation, " Error"
End
End If
'Check Code 128 Barcode Font is installed.
Dim bCompare As Boolean
Dim strFont As String
strFont = "Code 128"
For i = 0 To Screen.FontCount - 1
If Screen.Fonts(i) = "Code 128" Then strScreenFont = "Code 128"
Next
bCompare = StrComp(strFont, strScreenFont, vbTextCompare) = 0
If Not (bCompare) Then
MsgBox "Barcode font not installed. Reverting to printing non-barcode label.", vbInformation, "Barcode Font Not Installed!"
bPrintBarcode = False
Else
'Barcode font installed
bPrintBarcode = True
End If
End Sub
'Snippet from the printing routine that demonstrates switching font from barcode to courier font...
Sub Snippet()
'Label_WithBarcode:
'If bPrintBarcode = True Then
With Printer
.ScaleMode = vbCentimeters
.Orientation = 1
.Font = "Code 128"
.FontSize = 38
.FontBold = False
.FontItalic = False
.CurrentX = 1.2
.CurrentY = -0.15
Printer.Print "19293929"
.Font = "Courier New"
.FontSize = 11
.FontBold = True
.FontItalic = False
.CurrentX = 0
.CurrentY = 0.3
Printer.Print Space(4) & "19293929"
.CurrentX = 0
.CurrentY = 1.15
.FontSize = 15
Printer.Print Space(1) & StrConv(Surname, vbUpperCase)
.FontSize = 11
.CurrentY = 1.6
Printer.Print Space(17) & StrConv(Forenames, vbUpperCase)
Printer.Print " DofB: " & "13/2/2011" & Space(5) & "Gender : " & "(" & "Male" & ")"
.FontSize = 5
Printer.Print Space(1)
.FontSize = 11
'End If
.EndDoc
End With
' End If
End Sub
ASKER
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I just tried only printing the bar code that is half the size of the label,
even then the printers makes another blank label.
even then the printers makes another blank label.
ASKER
I discovered the
.enddoc
line closes the printing and causes the printer to feed one more label in blank.
Is there something that can be done with this particular line in order to stop it from advancing one more blank label each time I finish printing a label?
.enddoc
line closes the printing and causes the printer to feed one more label in blank.
Is there something that can be done with this particular line in order to stop it from advancing one more blank label each time I finish printing a label?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Here is my latest code, still getting the blank label at the end,
SimonAdept, I tried testing each line separeately but all cause the blank label agter printing.
Please all I need is not to have that blank label at then end.....
Here is my latest code:
Private Sub Command1_Click()
Snippet
End Sub
Private Sub Form_Load()
For i = 0 To Printers.Count - 1
' if the specified printer is found select it
If InStr(UCase(Printers(i).De viceName), "ZEBRA") > 0 Then
Set Printer = Printers(i)
SelectPrinter = True
Exit For
End If
Next i
If Not SelectPrinter Then
MsgBox "Unable to find Zebra printer ", vbOKOnly + vbExclamation, " Error"
End
End If
'Check Code 128 Barcode Font is installed.
Dim bCompare As Boolean
Dim strFont As String
strFont = "Code 128"
For i = 0 To Screen.FontCount - 1
If Screen.Fonts(i) = "Code 128" Then strScreenFont = "Code 128"
Next
bCompare = StrComp(strFont, strScreenFont, vbTextCompare) = 0
If Not (bCompare) Then
MsgBox "Barcode font not installed. Reverting to printing non-barcode label.", vbInformation, "Barcode Font Not Installed!"
bPrintBarcode = False
Else
'Barcode font installed
bPrintBarcode = True
End If
End Sub
'Snippet from the printing routine that demonstrates switching font from barcode to courier font...
Sub Snippet()
Dim X As Integer
'Label_WithBarcode:
'If bPrintBarcode = True Then
Open "c:\tmp\barcode_label.CSV" For Input As #1 Len = 60
Input #1, w1, w2, w3, w4, w5, w6
Input #1, w1, w2, w3, w4, w5, w6
w_pro_cod = Trim(w1)
w_bar_cod = Trim(w2)
w_pro_des = Trim(w3)
w_uni_pri = Trim(w4)
w_exp_dat = Trim(w5)
w_qty = Trim(w6)
Close #1
X = 2
With Printer
.ScaleMode = vbCentimeters
.Orientation = 1
.Font = "Code 128"
.FontSize = 30
.FontBold = False
.FontItalic = False
.CurrentX = 2.4
.CurrentY = 0.3
Printer.Print w_bar_cod
.Font = "Arial Narrow"
.FontSize = 11
.FontBold = True
.FontItalic = False
.CurrentX = X
.CurrentY = 0
Printer.Print "Botica Paradera"
.Font = "Arial Narrow"
.FontSize = 14
.FontBold = True
.FontItalic = False
.CurrentX = X
.CurrentY = 1.3
Printer.Print Space(8) & "F." & w_uni_pri;
.Font = "Arial Narrow"
.FontSize = 6
.FontBold = True
.FontItalic = False
.CurrentX = X
.CurrentY = 1.4
Printer.Print w_exp_dat
.Font = "Arial Narrow"
.FontSize = 8
.FontBold = True
.FontItalic = False
.CurrentX = X
.CurrentY = 1.8
Printer.Print w_pro_des
.EndDoc
End With
End Sub
SimonAdept, I tried testing each line separeately but all cause the blank label agter printing.
Please all I need is not to have that blank label at then end.....
Here is my latest code:
Private Sub Command1_Click()
Snippet
End Sub
Private Sub Form_Load()
For i = 0 To Printers.Count - 1
' if the specified printer is found select it
If InStr(UCase(Printers(i).De
Set Printer = Printers(i)
SelectPrinter = True
Exit For
End If
Next i
If Not SelectPrinter Then
MsgBox "Unable to find Zebra printer ", vbOKOnly + vbExclamation, " Error"
End
End If
'Check Code 128 Barcode Font is installed.
Dim bCompare As Boolean
Dim strFont As String
strFont = "Code 128"
For i = 0 To Screen.FontCount - 1
If Screen.Fonts(i) = "Code 128" Then strScreenFont = "Code 128"
Next
bCompare = StrComp(strFont, strScreenFont, vbTextCompare) = 0
If Not (bCompare) Then
MsgBox "Barcode font not installed. Reverting to printing non-barcode label.", vbInformation, "Barcode Font Not Installed!"
bPrintBarcode = False
Else
'Barcode font installed
bPrintBarcode = True
End If
End Sub
'Snippet from the printing routine that demonstrates switching font from barcode to courier font...
Sub Snippet()
Dim X As Integer
'Label_WithBarcode:
'If bPrintBarcode = True Then
Open "c:\tmp\barcode_label.CSV"
Input #1, w1, w2, w3, w4, w5, w6
Input #1, w1, w2, w3, w4, w5, w6
w_pro_cod = Trim(w1)
w_bar_cod = Trim(w2)
w_pro_des = Trim(w3)
w_uni_pri = Trim(w4)
w_exp_dat = Trim(w5)
w_qty = Trim(w6)
Close #1
X = 2
With Printer
.ScaleMode = vbCentimeters
.Orientation = 1
.Font = "Code 128"
.FontSize = 30
.FontBold = False
.FontItalic = False
.CurrentX = 2.4
.CurrentY = 0.3
Printer.Print w_bar_cod
.Font = "Arial Narrow"
.FontSize = 11
.FontBold = True
.FontItalic = False
.CurrentX = X
.CurrentY = 0
Printer.Print "Botica Paradera"
.Font = "Arial Narrow"
.FontSize = 14
.FontBold = True
.FontItalic = False
.CurrentX = X
.CurrentY = 1.3
Printer.Print Space(8) & "F." & w_uni_pri;
.Font = "Arial Narrow"
.FontSize = 6
.FontBold = True
.FontItalic = False
.CurrentX = X
.CurrentY = 1.4
Printer.Print w_exp_dat
.Font = "Arial Narrow"
.FontSize = 8
.FontBold = True
.FontItalic = False
.CurrentX = X
.CurrentY = 1.8
Printer.Print w_pro_des
.EndDoc
End With
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes I did try Martins suggestion, but still the ".enddoc" statement still releases one more blank label after finishing,
We migrated the whole source I sent you to visual basci 2013, its working fine now and problem solved.
Thank you Experts for all your effort and opinión they were ery useful to us in order to finish our testing and decide what to do.
Best regards!
We migrated the whole source I sent you to visual basci 2013, its working fine now and problem solved.
Thank you Experts for all your effort and opinión they were ery useful to us in order to finish our testing and decide what to do.
Best regards!