Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

From Excel via VBA, using Acrobat XI to Print PS-file and Convert to PDF

New Here ,
May 18, 2016 May 18, 2016

Hi all,

I try to print a worksheet from Excel 2013 (32-bit) Windows 7 to pdf with the following code:

Sub AcroPrintPdf(oPdfRange As Range) ' AcroPrintPdf Använder Adobe Acrobat Distiller för att skapa pdf

Dim sTmpPath As String, sPSFileName As String, sFileFormat As String

Dim sPDFFilename As String, myPDF As Object

sTmpPath = Environ("temp")

    ' Ge postscriptfilen ett namn

    sPSFileName = sTmpPath & "\" & "TempPostScript.ps"

    sFileFormat = "PDF Files (*.pdf), *.pdf"

            sPDFFilename = Application.GetSaveAsFilename("", filefilter:=sFileFormat, _

                  Title:="Skapa PDF")

    ' Skriv ut området i Excel till en postscriptfilen

    oPdfRange.PrintOut copies:=1, preview:=False, ActivePrinter:="Adobe PDF", _

        printtofile:=True, collate:=True, prtofilename:=sPSFileName

 

    ' Konvertera postscriptfilen till pdf

    Set myPDF = CreateObject("PdfDistiller.PdfDistiller.1")

    myPDF.FileToPDF sPSFileName, sPDFFilename, ""

End Sub



I get an error message and it does not create a PS file.

AcroError2.png

What goes wrong?

Grateful for any help!

Martin

TOPICS
Acrobat SDK and JavaScript
3.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 18, 2016 May 18, 2016

I don't know what's going wrong, but there is an easier way to convert from Excel to PDF. See here for more information, plus a sample Vbscript:

Prevent the Save Dialog when Printing to the Adobe PDF Printer

Translate
Community Expert ,
May 18, 2016 May 18, 2016

I don't know what's going wrong, but there is an easier way to convert from Excel to PDF. See here for more information, plus a sample Vbscript:

Prevent the Save Dialog when Printing to the Adobe PDF Printer

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 25, 2016 May 25, 2016
LATEST

Thanks for the help. It was just this bit of code that I needed:

exlwkbk.PrintOut , , , , "Adobe PDF"

Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines