Setting print copies in a ZDesigner S4M-300dpi ZPL en USB001: with Excel VBA

Olmedo

New Member
Joined
Nov 10, 2021
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
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
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,214,927
Messages
6,122,311
Members
449,080
Latest member
jmsotelo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top