Hi every one. I am trying to print labels from different ranges in a sheet ("Etiquetas") with different amount of copies per label from another sheet ("Rangos"). I get to print the labels but individually not by the different quantities in the "Rangos" sheet. The printer is a Zebra model ZDesigner S4M-300dpi ZPL on USB001 port; Windows 10 and Excel 2016. Here the code I have so far.
Private Sub CommandButton1_Click()
Dim AntImpresora As String
Dim NueImpresora As String
Dim ssheet As Worksheet
Dim rsheet As Worksheet
Dim imprng1 As Range
Dim imprng2 As Range
Dim imprng3 As Range
Dim imprng4 As Range
Dim imprng5 As Range
Dim imprng6 As Range
Dim imprng7 As Range
Dim imprng8 As Range
Dim imprng9 As Range
Dim imprng10 As Range
Set ssheet = ThisWorkbook.Sheets("Etiquetas")
Set rsheet = ThisWorkbook.Sheets("Rangos")
Set imprng1 = ssheet.Range("A1:E6")
Set imprng2 = ssheet.Range("A7:E12")
Set imprng3 = ssheet.Range("A13:E18")
Set imprng4 = ssheet.Range("A19:E24")
Set imprng5 = ssheet.Range("A25:E30")
Set imprng6 = ssheet.Range("A31:E36")
Set imprng7 = ssheet.Range("A37:E42")
Set imprng8 = ssheet.Range("A43:E48")
Set imprng9 = ssheet.Range("A49:E54")
Set imprng10 = ssheet.Range("A55:E60")
AntImpresora = Application.ActivePrinter
NueImpresora = "ZDesigner S4M-300dpi ZPL en USB001:"
On Error Resume Next
Application.ActivePrinter = NueImpresora
If Err.Number <> 0 Then Application.Dialogs(xlDialogPrinterSetup).Show
imprng1.PrintOut Copies:=rsheet.Range("B4")
imprng2.PrintOut Copies:=rsheet.Range("B5")
imprng3.PrintOut Copies:=rsheet.Range("B6")
imprng4.PrintOut Copies:=rsheet.Range("B7")
imprng5.PrintOut Copies:=rsheet.Range("B8")
imprng6.PrintOut Copies:=rsheet.Range("B9")
imprng7.PrintOut Copies:=rsheet.Range("B10")
imprng8.PrintOut Copies:=rsheet.Range("B11")
imprng9.PrintOut Copies:=rsheet.Range("B12")
imprng10.PrintOut Copies:=rsheet.Range("B13")
Application.ActivePrinter = AntImpresora
End Sub
Private Sub CommandButton1_Click()
Dim AntImpresora As String
Dim NueImpresora As String
Dim ssheet As Worksheet
Dim rsheet As Worksheet
Dim imprng1 As Range
Dim imprng2 As Range
Dim imprng3 As Range
Dim imprng4 As Range
Dim imprng5 As Range
Dim imprng6 As Range
Dim imprng7 As Range
Dim imprng8 As Range
Dim imprng9 As Range
Dim imprng10 As Range
Set ssheet = ThisWorkbook.Sheets("Etiquetas")
Set rsheet = ThisWorkbook.Sheets("Rangos")
Set imprng1 = ssheet.Range("A1:E6")
Set imprng2 = ssheet.Range("A7:E12")
Set imprng3 = ssheet.Range("A13:E18")
Set imprng4 = ssheet.Range("A19:E24")
Set imprng5 = ssheet.Range("A25:E30")
Set imprng6 = ssheet.Range("A31:E36")
Set imprng7 = ssheet.Range("A37:E42")
Set imprng8 = ssheet.Range("A43:E48")
Set imprng9 = ssheet.Range("A49:E54")
Set imprng10 = ssheet.Range("A55:E60")
AntImpresora = Application.ActivePrinter
NueImpresora = "ZDesigner S4M-300dpi ZPL en USB001:"
On Error Resume Next
Application.ActivePrinter = NueImpresora
If Err.Number <> 0 Then Application.Dialogs(xlDialogPrinterSetup).Show
imprng1.PrintOut Copies:=rsheet.Range("B4")
imprng2.PrintOut Copies:=rsheet.Range("B5")
imprng3.PrintOut Copies:=rsheet.Range("B6")
imprng4.PrintOut Copies:=rsheet.Range("B7")
imprng5.PrintOut Copies:=rsheet.Range("B8")
imprng6.PrintOut Copies:=rsheet.Range("B9")
imprng7.PrintOut Copies:=rsheet.Range("B10")
imprng8.PrintOut Copies:=rsheet.Range("B11")
imprng9.PrintOut Copies:=rsheet.Range("B12")
imprng10.PrintOut Copies:=rsheet.Range("B13")
Application.ActivePrinter = AntImpresora
End Sub