ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   pdfDist.FileToPDF does nothing (https://www.excelbanter.com/excel-programming/362069-pdfdist-filetopdf-does-nothing.html)

[email protected]

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


SA

pdfDist.FileToPDF does nothing
 
Running the distiller com object does require administrator privileges on
your machine. That may be an issue.

If you want a relatively easy way to output a worksheet or whole workbook to
a PDF file using VBA and Acrobat 7, you might want to look at our XL PDF
Wizard Add In. You can not only automate creation of XL based PDFs but also
merge in Word docs and external PDF files and bookmark the whole thing using
code. You'll find it in the developer tools section of our web.

Hope this helps
--
SA
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

wrote in message
oups.com...
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





All times are GMT +1. The time now is 04:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com