Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-22-2020, 01:25 PM
trevorc trevorc is offline Still on this printer thing Windows 7 32bit Still on this printer thing Office 2013
Competent Performer
Still on this printer thing
 
Join Date: Jan 2017
Posts: 174
trevorc will become famous soon enoughtrevorc will become famous soon enough
Default Still on this printer thing

Why doesn't the line of code below work, its in a standard module



Dim prtPrinter As Printer

It just errors out with User defined type not defined

How do I define Printer so i can then Dim prtPrinter as one ???
Everything else is working ok, if i use the .PrintOut Copies:=3, preview:=True method I can preview this but don't get the full - print preview and print dialog

I just need to incorporate setting the number of copies into my code

Here's my full routine

Code:
Sub AAA()

    Dim prtPrinter As Printer
   
   Application.EnableEvents = False
    Select Case ActiveSheet.Name
        Case Is = "Mac Label"
            Application.ActivePrinter = "\\U2-front-desk\bixolon slp-d420 on Ne05:"
        Case Is = "Address Label"
            Application.ActivePrinter = "ZDesigner GK420t on 9100"
        Case Is = "BinBot Part Labels"
            Set prtPrinter.Copies = 2
            Application.ActivePrinter = "ZDesigner GK420t on 9100"
        Case Is = "Repair Labels"
            Application.ActivePrinter = "\\U2-front-desk\bixolon slp-d420 on Ne05:"
        Case Is = "RMA Labels"
            Application.ActivePrinter = "\\U2-front-desk\TSC TTP-346M Pro on Ne06:"
        Case Else
            Application.ActivePrinter = "Brother DCP-7065DN Printer on Ne04:"
    End Select
    t = Application.Dialogs(xlDialogPrint).Application
    Application.CommandBars.ExecuteMso ("PrintPreviewAndPrint")
    Application.EnableEvents = True
End Sub
Reply With Quote
  #2  
Old 07-22-2020, 05:11 PM
trevorc trevorc is offline Still on this printer thing Windows 7 32bit Still on this printer thing Office 2013
Competent Performer
Still on this printer thing
 
Join Date: Jan 2017
Posts: 174
trevorc will become famous soon enoughtrevorc will become famous soon enough
Default

Just an update on this, I have given up on trying to set the copies count, but have found another issue.
I added code to remove the QR code after printing, but running this code removes the QR code before print preview, even though the code is after the Print preview and print modal dialog. How is this possible???
See extra lines of code below

Code:
Sub AAA()
    Application.EnableEvents = False
    Select Case ActiveSheet.Name
        Case Is = "Mac Label"
            Application.ActivePrinter = "\\U2-front-desk\bixolon slp-d420 on Ne05:"
        Case Is = "Address Label"
            Application.ActivePrinter = "ZDesigner GK420t on 9100"
        Case Is = "Part Labels"
            Application.ActivePrinter = "ZDesigner GK420t on 9100"
        Case Is = "Repair Labels"
            Application.ActivePrinter = "\\U2-front-desk\bixolon slp-d420 on Ne05:"
        Case Is = "RMA Labels"
            Application.ActivePrinter = "\\U2-front-desk\TSC TTP-346M Pro on Ne06:"
        Case Else
            Application.ActivePrinter = "Brother DCP-7065DN Printer on Ne04:"
    End Select
    t = Application.Dialogs(xlDialogPrint).Application
    Application.CommandBars.ExecuteMso ("PrintPreviewAndPrint")
    Application.EnableEvents = True
    ActiveSheet.Shapes.Range(Array("BC$E$9#GR")).Select
    Selection.Delete
End Sub
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I put thing in Word ANYWHERE? greenagent Word 6 03-06-2019 03:17 AM
Want to remove this square thing tonythegreek Word 1 09-22-2018 02:08 PM
Still on this printer thing This thing is driving me nuts cachaco Word 6 06-25-2015 04:40 AM
Printer Problems-Need to reload printer each day jekronenfeld Windows 1 11-24-2014 12:35 AM
MS Word 2003, printer queue in 'printer properties' shows 1 job; no job in printer benhuxham Word 0 07-25-2011 06:58 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:30 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft