On some PC's prints to default windows printer rather then Acrobat PDF defined in code

K

Ken

I'm using the Ken McDaniels version (see link below) of automatically
printing an Excel spreadsheet to Acrobat PDF.
http://www.planetpdf.com/mainpage.asp?webpageid=762

It works perfectly. However, on one PC it always prints to the DEFAULT
windows printer rather the Acrobat Pro. If I change the default windows
printer to Acrobat, then it creates the PDF. On another PC it ignores the
default windows PC and prints to the defined PDF.

Ken
 
K

Ken

Ok, here is the code in case anyone can benefit from it.

What is interesting is that every printer name in your "Printer and Faxes"
folder ends in "on NeXX", where "XX" is a different number for each printer
listed. Therefore, you must use the STOP as shown below and then hover over
the line above it to know what number will replace the XX.

If someone would like to contribute a method of automating the process of
figuring out the XX, and feeding it to the code, that would be great.

'Print the document to PDF specifically using the"Adobe PDF on Ne07:"
Dim STDprinter As String

STDprinter = Application.ActivePrinter
'To get the adobe PDF printer name, set it as the default printer
and use this stop
' then hover over the line above to get the actual printer name
'Stop

' change printer
Application.ActivePrinter = "Adobe PDF on Ne07:"
' prints the active sheet
ActiveSheet.PrintOut , PrintToFile:=True
' change back to standard printer
Application.ActivePrinter = STDprinter

Thanks,

Ken
 

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

Top