View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] barbetta3141@yahoo.com is offline
external usenet poster
 
Posts: 20
Default pdfDist.FileToPDF does nothing

Hello,

I'm trying to automate the creation of pdf files. I posted my code
below. The line I'm having problems with is

pdfDist.FileToPDF "c:\My Documents\testExcelToPDF.PS", "c:\My
Documents\testExcelToPDF.pdf", ""

The code runs without causing any errors, but the Adobe code doesn't
seem to work. I can see the .ps file being created, but when I step
through the FileToPDF line, nothing happens (no pdf is created, but no
error either). I'm using Excel 2003 with Acrobat 7.0 Professional and
Distiller 7.0. Thanks for your help.


Public Sub PostProblemOnNewsgroup()
Dim pdfDist As New ACRODISTXLib.PdfDistiller
Dim pdfPrinter, pdfName
Dim strFileName As String

Set fs = CreateObject("Scripting.FileSystemObject")

strFileName = "testExcelToPDF.ps"
Application.ActivePrinter = "Adobe PDF on Ne02:"

ActiveWindow.SelectedSheets.PrintOut Copies:=1, preview:=False, _
ActivePrinter:="Adobe PDF on Ne02:", printtofile:=True, _
collate:=True, PrToFileName:=strFileName

pdfDist.FileToPDF "c:\My Documents\testExcelToPDF.PS", "c:\My
Documents\testExcelToPDF.pdf", ""
Set pdfDist = Nothing
fs.DeleteFile pdfFilePath & "*.PS"
End Sub