Default Printer

P

Preet

Hi

I hope you can help and THANK YOU in advance!!

I have a document with a macro. On opening, it mail merges, and then
brings up the "Save As" box to "Save as PDF", this is because I have
set the "Active Printer = "Acrobat Distiller", after this I wanted to
add a simple code to say "Active Printer = "default" i.e. back to the
default printer

But I cannot get it to do this, it keeps the Acrobat Distiller option
as the default printer.

I cannot specify a printer as differnt users will be using the doc and
have different default printers.

I have used the link below to help, but this doesnt help me at all:

http://word.mvps.org/FAQs/MacrosVBA/ChangeCurPrinter.htm


This is my code so far:

'ActivePrinter = "Acrobat Distiller"
' Application.PrintOut FileName:="", Range:=wdPrintAllDocument,
Item:= _
' wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
' ManualDuplexPrint:=False, Collate:=True, Background:=True,
PrintToFile:= _
' False, PrintZoomColumn:=0, PrintZoomRow:=0,
PrintZoomPaperWidth:=0, _
' PrintZoomPaperHeight:=0
ActivePrinter = "default" - BUT THIS DOESNT WORK

Then I used this:


Dim sCurrentPrinter As String
sCurrentPrinter = ActivePrinter
ActivePrinter = "Acrobat Distiller"
Application.PrintOut FileName:=""
ActivePrinter = sCurrentPrinter

Thank you - sorry for the LONG email!
 
G

Graham Mayor

You need to store the active printer information before changing it, then
restore the saved information eg

Dim sCurrentPrinter As String
sCurrentPrinter = ActivePrinter 'save the current driver
ActivePrinter = "Adobe PDF" 'set the required driver
Application.PrintOut FileName:="" 'print the document
ActivePrinter = sCurrentPrinter 'reset the original printer


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
P

Preet

Hi Graham

Thank you for ur response. I tried what you had said and below is th
code used, after Saving as a PDF, I need to then close the documen
with NO changes, but when I add this code, it doesnt save the PDF, i
brings the dialogue box "Save as PDF" but once I press ok - this doesn
get saved, I guess its getting conflicting messages, asking it to "Sav
as PDF" and then close the doc with no changes.

Are you able to help?


Dim sCurrentPrinter As String
sCurrentPrinter = ActivePrinter 'save the current driver
ActivePrinter = "Acrobat Distiller" 'set the required driver
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:
_wdPrintDocumentContent, Copies:=1, Pages:=""
PageType:=wdPrintAllPages, _ManualDuplexPrint:=False, Collate:=True
Background:=True, PrintToFile:= _False, PrintZoomColumn:=0
PrintZoomRow:=0 PrintZoomPaperWidth:=0, _PrintZoomPaperHeight:=0

ActivePrinter = sCurrentPrinter 'reset the original printer


ActiveDocument.Close wdDoNotSaveChanges, wdOriginalDocumentFormat, 0



Most appreciated.

Thank you
 
G

Graham Mayor

Try

Dim sCurrentPrinter As String
sCurrentPrinter = ActivePrinter
ActivePrinter = "Acrobat Distiller"
Options.PrintBackground = False
Application.PrintOut
ActivePrinter = sCurrentPrinter
Options.PrintBackground = True
ActiveDocument.Close wdDoNotSaveChanges


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top