Application active printer help

Shadkng

Active Member
Joined
Oct 11, 2018
Messages
365
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
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,214,965
Messages
6,122,500
Members
449,090
Latest member
RandomExceller01

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