Adobe PDF Writer error
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
"Lea" wrote in message ...
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!
|