Set default printer for excel

Unexpc

Active Member
Joined
Nov 12, 2020
Messages
496
Office Version
  1. 2019
Platform
  1. Windows
Hi guys

there is a option or macro i choose one printer for default?(beacuse i change printer in multiple app and when i change printer, in the excel changed printer, i want choose a default printer just for excel)
 

Attachments

  • Screenshot 2020-11-14 171627.jpg
    Screenshot 2020-11-14 171627.jpg
    63.5 KB · Views: 34

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
VBA Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
    Cancel = True
    Dim DefaultPrinter As String
    Dim Tempraryprinter As String

    Tempraryprinter = "Name your Printer" ' <<<<<<Or others like "Microsoft Print to PDF"

    DefaultPrinter = Application.ActivePrinter
    ActiveSheet.PrintOut Preview:=False, ActivePrinter:=Tempraryprinter, PrintToFile:=True, PrToFileName:=PSFileName
    Cancel = False
    Application.ActivePrinter = DefaultPrinter

End Sub

P.gif
 

Attachments

  • Printer.png
    Printer.png
    51.8 KB · Views: 25
Upvote 0
VBA Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
    Cancel = True
    Dim DefaultPrinter As String
    Dim Tempraryprinter As String

    Tempraryprinter = "Name your Printer" ' <<<<<<Or others like "Microsoft Print to PDF"

    DefaultPrinter = Application.ActivePrinter
    ActiveSheet.PrintOut Preview:=False, ActivePrinter:=Tempraryprinter, PrintToFile:=True, PrToFileName:=PSFileName
    Cancel = False
    Application.ActivePrinter = DefaultPrinter

End Sub

View attachment 26075
Thanks man but i have a problem, when i select quick print and i print, it shows again save output as...
What am i do? (I tested microsoft print to pdf that is good and i set it default printer)
 
Upvote 0
try
VBA Code:
Private Sub Workbook_Open()
    Dim DefaultPrinter As String
    Dim Tempraryprinter As String

    Tempraryprinter = "Microsoft Print to PDF" '

   Application.ActivePrinter = Tempraryprinter & " on Ne01:"
    

End Sub
 
Upvote 0
Solution
try
VBA Code:
Private Sub Workbook_Open()
    Dim DefaultPrinter As String
    Dim Tempraryprinter As String

    Tempraryprinter = "Microsoft Print to PDF" '

   Application.ActivePrinter = Tempraryprinter & " on Ne01:"
   

End Sub
Yeah thats work, THANKS
 
Upvote 0
You are welcome
Thank you for Feedback
Hi again
i have recently receive an error for color line
VBA Code:
Private Sub Workbook_Open()
    Dim DefaultPrinter As String
    Dim Tempraryprinter As String


    Tempraryprinter = "Microsoft Print to PDF" '


[COLOR=rgb(226, 80, 65)]   Application.ActivePrinter = Tempraryprinter & " on Ne01:"[/COLOR]
   


End Sub
this may been this problem from another code in this workbook codes?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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