Creating PDF from Excel Using PrintToFile

C

Carmen

Hello,

I've looked through the web to learn that if I want to convert Excel to PDF
and give it a specific name (automatically) through macro I should use

....printout PrintToFile:=True, PRtoFileName:="I/....xx.pdf"

But there's an error accessing the created pdf. It's all due to PrintToFile
functionality. If I change destination file name extension to .prn, then it
works.

However, when I double click on this .prn file it asks me to choose a
program. It then converts it to adobe acrobat file.

It's there a more direct way to create from excel to pdf and having file
name as variable? My intention is to create batches of pdfs from excel and
through macro emailing out to people. I want to skip the step of converting
from .prn to .pdf (haven't figured how I would do it).

Thanks,
Carmen
 
J

JLGWhiz

Microsoft does not support the PDF conversion. However, they recommend a
service to do it. There are several with free downloadable converters.
Google the web for Excel to PDF converter.
 
M

MC

It can be done e.g. with Bullzip PDF printer - www.bullzip.com.
I built PDF's save option in the one of my projects using Ghostscript as
well, but it requires a much more code to generate a postscript file
first and convert it to pdf (I guess you would like to use the Bullzip
choice). There is available some documentation with Bullzip here
http://www.bullzip.com/products/pdf2/doc/info.php#Settings.
It seems your task can be simply done via Bullzip settings.ini file
modifying.

HTH
Mariusz


JLGWhiz pisze:
 
C

Carmen

Due to office policy and the fact that this will have to be shared with other
units. I'm unable to install Ghostscript. This means that I might have to
take the long way. Is there a suggestion as to where I can find some help
on this?

Thanks very much,
Carmen
 
K

Karl

You can install a PDF printer driver such as PDF995
make the PDF driver driver the default printer in Windows
 
T

Tony Gravagno

The free PDFCreator is another similar, and IMO better option. The
following macro shows how to change the printer and print the document
at runtime. Source:
<http://www.exceltip.com/st/Change_the_default_printer_using_VBA_in_Microsoft_Excel/453.html>

You'll need to keep the name of the PDF printer consistent on all
workstations, or store the name of the PDF printer somewhere and read
it at runtime. This macro has it hardcoded to a specific fax device.

Sub PrintToAnotherPrinter()
Dim STDprinter As String
STDprinter = Application.ActivePrinter
Application.ActivePrinter = "microsoft fax on fax:"
' change printer
ActiveSheet.PrintOut
' prints the active sheet
Application.ActivePrinter = STDprinter
' change back to standard printer
End Sub

You may not like the idea of installing something like PDFCreator on
your systems, but you don't have much of a choice honestly - the PC
needs to have a driver and need to be made aware of the printer.

HTH
 

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