Printing to File (PDF)

I

igorek

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
 
I

igorek

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
 
J

jaf

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
 
I

igorek

you are the best, thank you


jaf said:
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
 
N

Noel

I have an issue similar to the original post and have tried implementing the
solution offered. However, I receive an error in the Dim myPDF As
PdfDistiller step: User-defined type not defined. Outside the macro, I
write from Excel to PDF all the time and I have Acrobat Distiller 8
installed. Any thoughts? Thanks.
 
D

Dave Peterson

Noel got a response to his later post.
I have an issue similar to the original post and have tried implementing the
solution offered. However, I receive an error in the Dim myPDF As
PdfDistiller step: User-defined type not defined. Outside the macro, I
write from Excel to PDF all the time and I have Acrobat Distiller 8
installed. Any thoughts? Thanks.
 

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