Link to home
Start Free TrialLog in
Avatar of Tom Crowfoot
Tom CrowfootFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Word 2010 - print to specific printer

Dear Experts

I have a macro to print a word doc to PDF which is below.  But the code changes the default printer but I am keen to keep the user's default printer as is. I am assuming that there are 2 ways to tackle this:

Option 1: modify the code below so it doesn't change the default printer

Option 2: record the details the of the default printer, then run this code & then set the default back again.

I'm easy on either method if they're both "good practice"

Sub PDF()
    
' Print to PDF macro

ActivePrinter = "PDFCreator"
    Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
        wdPrintDocumentWithMarkup, Copies:=1, Pages:="", PageType:= _
        wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
        PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
        PrintZoomPaperHeight:=0
End Sub

Open in new window


Can anybody help?
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tom Crowfoot

ASKER

Perfect - thank you for the swift response
If you need to print to a particular printer, you must make it the active printer. The printer is not an argument in the PrintOut method .
Swift acceptance too! Thank you.