Private Sub Workbook_Open()
Dim DefaultPrinter As String
Dim Tempraryprinter As String
Tempraryprinter = "Microsoft Print to PDF" '
Application.ActivePrinter = Tempraryprinter & " on Ne01:"
End Sub
CreateObject("WScript.Network").SetDefaultPrinter "Microsoft Print to PDF"
i just set a default printer for excel app,for example a code use in private sub before printAlso Check this method:
Go Settings -> Devices -> Printers & Scanners, scroll down and un-check "Let Windows manage my default printer".
Then Use this code:
VBA Code:CreateObject("WScript.Network").SetDefaultPrinter "Microsoft Print to PDF"
How about this do you know?Then again use this line at the last of your code at set back printer name to your previous default printer.