IMPRIMIR ETIQUETA
Publicado por ROBERTO ANTONIO (81 intervenciones) el 18/07/2018 13:27:04
Hola, hoy vengo con algo complejo y nuevamente recurro a los más expertos en el tema. Ojalá puedan orientarme con un código por favor. Lo que hace el evento es imprimir una etiqueta de una aplicación llamada bartender, y lo que quiero es que me imprima dos etiquetas (cada archivo de etiqueta tiene su nombre) les dejo el código para ver como lo puedo hacer poque no me sale :/ .
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Public Function etiq(f As Form, pe As Double, lad As Integer)
Dim RS As DAO.Recordset
Dim et, t, cuadros As String
Dim btApp As BarTender.Application
Dim btFormat As BarTender.Format
Dim btDb As BarTender.Database
Dim PESO As Double
Set btApp = CreateObject("BarTender.Application")
Set RS = CurrentDb.OpenRecordset("SELECT * FROM ETIQUETA;")
While Not RS.EOF
If RS.Fields("USAR") = -1 Then
Set btFormat = btApp.Formats.Open("C:\CONSOLA\labels\" & RS.Fields("ETIQUETA") & "")
et = RS.Fields("DESTINO")
End If
RS.MoveNext
Wend
RS.Close
If Forms!consola.OTROS2 = 1 Or Forms!consola.OTROS2 = 3 Then
Set btFormat = btApp.Formats.Open("C:\CONSOLA\labels\SANEA.btw")
End If
PESO = pe
cuadros = btFormat.NamedSubStrings.GetAll(": ", vbCrLf)
'===========datos==================
'''''''''ejemplo''''''''''''''
If InStr(1, cuadros, "wgtkg", vbTextCompare) <> 0 Then
btFormat.SetNamedSubStringValue "wgtkg", PESO
End If
If InStr(1, cuadros, "LADO", vbTextCompare) <> 0 Then
btFormat.SetNamedSubStringValue "LADO", lad
End If
If InStr(1, cuadros, "code128", vbTextCompare) <> 0 Then
btFormat.SetNamedSubStringValue "code128", Format(Format(f.FP, "y"), 0) & JUL_YEAR(Format(f.FP, "yy")) & Left(f.LOTE, 6) & Format(PESO * 10, "00000") & f.grasa & lad & Format(f.GAN, "0000") & Format(f.CANAL, "0000")
End If
If InStr(1, cuadros, "bodystring", vbTextCompare) <> 0 Then
btFormat.SetNamedSubStringValue "bodystring", f.CANAL
End If
For I = 1 To 15
If f.Controls("B" & I & "").Value = -1 Then
t = f.Controls("B" & I & "").Caption
End If
Next I
If InStr(1, cuadros, "barra", vbTextCompare) <> 0 Then
btFormat.SetNamedSubStringValue "barra", Left(f.LOTE, 6) & 0 & Format(f.CANAL, "0000") & Chr(f.CAT) & Format(PESO * 10, "00000") & lad
End If
If InStr(1, cuadros, "slaughteryearidentifier", vbTextCompare) <> 0 Then
btFormat.SetNamedSubStringValue "slaughteryearidentifier", Format(Format(f.FP, "y"), 0) & JUL_YEAR(Format(f.FP, "yy"))
End If
If InStr(1, cuadros, "COPIAS", vbTextCompare) <> 0 Then
btFormat.SetNamedSubStringValue "COPIAS", DCount("imprimir", "cuartos", "[imprimir] =-1")
End If
'==============================
If f.OTROS2 = 1 Or f.OTROS2 = 3 And f.MSJ = "ESPERANDO LADO 2" Then
btFormat.PrintOut
End If
For I = 1 To DCount("*", "COPIAS")
btFormat.PrintOut
Next I
btApp.Quit
End Function
Valora esta pregunta
0