View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default Printing to File (PDF)

Hi Igor,
I used this with Acrobat installed with success.
With Acrobat you need to create a postscript file first and then convert it to a pdf.


MyPath="c:\whatever you want"

MyFile = igorsfilename 'Create postscript filename.(no file extension)

PSFileName = myPath & MyFile & ".ps"

'Print page using distiller.
MySheet.PrintOut , , 1, False, True, True, False, myPath & MyFile & ".ps"

'Define PDF filename
myPDFFileName = myPath & MyFile & ".pdf"

'Define postscript log filename. Don't need this but distiller creates it anyway.
myPDFLog = myPath & MyFile & ".log"

'Create a new distiller object.
Set myPDF = New PdfDistiller
'Conver postscript file to PDF.
myPDF.FileToPDF PSFileName, myPDFFileName, ""

'Delete the postscript & log files.
Kill PSFileName
Kill myPDFLog

'kill the Distiller object.
Set myPDF = Nothing

'Go back and do next file.

John


"igorek" wrote in message ...
Hi Jim,
Thanks for the post, however the code on this site is referring to VB code
that is not available to me. All i have is crippled VBA under excel. And
also, his code requires PDFCreator installed. I just bought Adobe Standard
for $200 and do not want to spend another $300 for creator. Is there any
other way you can suggest or know of?

Thanks
Igor


"Jim Thomlinson" wrote:

Sourceforge has a more robust set of APIs to print PDFs. Check out this link...

http://www.excelguru.ca/node/21

NASA uses this one...
--
HTH...

Jim Thomlinson


"igorek" wrote:

Hi All,
Here is the issue i'm facing, if anyone could help i would really appreciate.

I have a file with number of ranges that i need to print. Macro activates
those ranges and sends every single one to the printer. Now i want to instead
of printing to printer, print to PDF file usind PDF995. Unfortunatelly, for
every range printed it always promts me to name the pdf file.
Is there a way to specify pdf file name in the code to avoid the prompt?

Thanks
Igor