Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return to default printer after using .FilePrintSetup 1

Status
Not open for further replies.

dotobi

Technical User
Mar 9, 2004
229
HK
Hi

Within MS Word, I've set up a macro to print to a specific printer using .FilePrintSetup , then print 2 copies out using different trays.

Is there a way to set word BACK to the DEFAULT printer at the end of the macro, so that if the user prints any other documents, they print to the default printer (without having to manually change in "File>Print...")?

The code so far is:
Code:
Sub printLHPL()
'
' printLHPL Macro
' Macro recorded 11/04/2005 by Nabeel
'
Application.WordBasic.FilePrintSetup Printer:="\\servername\printername on prinerport", _
    DoNotSetAsSysDefault:=1
    With ActiveDocument.Styles(wdStyleNormal).Font
        If .NameFarEast = .NameAscii Then
            .NameAscii = ""
        End If
        .NameFarEast = ""
    End With
    With ActiveDocument.PageSetup
        .FirstPageTray = wdPrinterLowerBin
        .OtherPagesTray = wdPrinterPaperCassette
    End With
    ActiveDocument.PrintOut
    With ActiveDocument.Styles(wdStyleNormal).Font
        If .NameFarEast = .NameAscii Then
            .NameAscii = ""
        End If
        .NameFarEast = ""
    End With
    With ActiveDocument.PageSetup
        .FirstPageTray = wdPrinterPaperCassette
        .OtherPagesTray = wdPrinterPaperCassette
    End With
    ActiveDocument.PrintOut
End Sub

This code does not change the default printer, but word retains the last printer used as the one to print to next.

Thanks

Kev
 
Sub printLHPL()
Dim strPrinter As String
strPrinter = Application.ActivePrinter
' your code here
Application.ActivePrinter = strPrinter
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top