Adobe PDF Writer error

L

Lea

I recently installed Acrobat v6, and now I am having a
problem automatically converting files from Excel to PDF.
The line in question is:

ActiveSheet.PrintOut ActivePrinter:="Adobe PDF on NE00",
PrintToFile:=True, PrToFileName:="C:\Lea\a.pdf"

If I leave off the "PrintToFIle" and the "PrToFIleName",
then it seems to work, except that it prompts me for a
filename to save the pdf. If I try it as is, I get a
nasty error saying that either my port is set up
incorrectly, or I have run out of space.

Has anyone seen this? And does anyone have any
suggestions?

Thanks!
 
D

Dan E

Lea,

I can remember having trouble's automating the PDF printing.
Though I can't remember exactly what they were. I found this
macro on somebodies site and it works well...

Private Sub CommandButton1_Click()
' Define the postscript and .pdf file names.
Dim PSFileName As String
Dim PDFFileName As String
PSFileName = "c:\myPostScript.ps"
PDFFileName = "c:\myPDF.pdf"


' Print the Excel range to the postscript file
Dim MySheet As Worksheet
Set MySheet = ActiveSheet
ActiveSheet.PrintOut copies:=1, preview:=False, ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True,
prtofilename:=PSFileName


' Convert the postscript file to .pdf
Dim myPDF As PdfDistiller
Set myPDF = New PdfDistiller
myPDF.FileToPDF PSFileName, PDFFileName, ""

Kill (PSFileName)

End Sub

You can have it prompt for a save as name by changing
PDFFileName = "c:\myPDF.pdf" 'to:
PDFFileName = Application.GetSaveAsFilename

Dan E
 
D

Dan E

Shoulda mentioned,

This works on Acrobat 5. I can't guarantee it will on 6.
Watch out for word wrap on the posted code.

Dan E
 

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