Application active printer help

Shadkng

Board Regular
Joined
Oct 11, 2018
Messages
228
Hi, I have a few questions about the below code. This macro prints a small range of label data repeatedly to a Zebra label printer. The way it's written it seems to send the data to the printer one label at a time in the loop. I assume there is no way to buffer the data so there is a continuous stream printing. I sometimes take the printer off line and then wait a bit do it prints more continuously. If anyone has any ideas I would appreciate it.

My other question - I just added the application activeprinter line to switch to the Zebra printer. I want to make sure that this printer change is not happening for each individual label output. I assume it's not because the line is not in the loop. I've had help writing code and don't always understand it completely. Thanks for the advice.

VBA Code:
Sub SHADE_LABELS_PRINT()
Dim r As Long, StrPrn As String
StrPrn = Application.ActivePrinter
Application.ActivePrinter = "ZEBRA JIM on Ne00:"
With ActiveSheet
  With .PageSetup
    .Zoom = False
    .FitToPagesWide = 1
    .FitToPagesTall = 1
    .LeftMargin = 0
    .TopMargin = 0
    .RightMargin = 0
    .BottomMargin = 5
  End With
  'If Not (Application.Dialogs(xlDialogPrinterSetup).Show) Then Exit Sub
  
  For r = 10 To .Cells.SpecialCells(xlCellTypeLastCell).Row Step 8

    If Range("B" & r).Value > 0 Then
      With .PageSetup
        .PrintArea = "$C$" & r & ":$D$" & r + 6
         ActiveSheet.PrintOut Copies:=Range("B" & r).Value
      End With
    End If
  Next
End With

response = MsgBox("WOULD YOU LIKE TO PRINT BULK LABLES?", vbYesNo)
      If response = vbYes Then
        Call BULK_BRACKETS_LABEL_PRINT
      Else
      End If
        Exit Sub

'Application.ActivePrinter = StrPrn
End Sub
 

Some videos you may like

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Watch MrExcel Video

Forum statistics

Threads
1,118,656
Messages
5,573,432
Members
412,529
Latest member
cTatch
Top