Printing to PDF using distiller

cfoye130

Board Regular
Joined
Aug 12, 2008
Messages
84
I have Adobe Distiller 8.0. Using Excel '07.

The following code runs fine, but the pdf output that occurs is not a pdf but rather a log file stating:

%%[ Error: undefined; OffendingCommand: E*t600R&u600D*r0F&l1o&l2A&l7H&l0S&l1X&l8c1E*p0x0Y*c0t7632x5880Y*b0M ]%%
%%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
%%[ Warning: PostScript error. No PDF file produced. ] %%

There is lots on the internet about the error, but I can't find a solution. I need to use distiller rather than Excels PDF solution, because the PDF solution from microsoft messess up the format of the charts where distiller does not. Any help would be greatly appreciated. Thanks!

Code:
Sub InFlightUpdate()
    Dim I As Integer
    Dim wbJIRA As Workbook
    Dim wbResults As Workbook
    Dim wbInflight As Workbook
    Dim wbInflightLoc As String
    Dim InProcessFile As String
    Dim wbInflightLoc2 As String
    Dim PDFStartLoc As String
    Dim PDFEndLoc As String
    Dim PDFSheet As Worksheet
    Dim oPDF As PdfDistiller
    Dim TmpPSFile As String
 
    InProcessFile = "H:\Inprocess.xlsx"
 
    I = 2
    Do Until IsEmpty(Sheet2.Cells(I, 1))
'Action if effort is active, but not in test
        If Sheet2.Cells(I, 11).Value = 1 Then
            wbInflightLoc = Sheet2.Cells(I, 2).Value
            wbInflightLoc2 = Sheet2.Cells(I, 8).Value
            PDFStartLoc = Sheet2.Cells(I, 9).Value
            PDFEndLoc = Sheet2.Cells(I, 10).Value
            Name PDFStartLoc As PDFEndLoc
            Set wbInflight = Application.Workbooks.Open(wbInflightLoc)
                wbInflight.Sheets(2).Cells(75, 2).Value = Sheet2.Cells(I, 6).Value
                Kill InProcessFile
                wbInflight.SaveAs (InProcessFile)
                wbInflight.Close True
                Kill wbInflightLoc2
            Set wbInflight = Application.Workbooks.Open(InProcessFile)
                Set PDFSheet = ActiveSheet
                Set oPDF = New PdfDistiller
                TmpPSFile = "H:\TmpPSFile.ps"
                PDFSheet.PrintOut copies:=1, preview:=False, _
                ActivePrinter:="Acrobat Distiller", printtofile:=True, _
                collate:=True, PrToFileName:=TmpPSFile
                oPDF.FileToPDF TmpPSFile, PDFStartLoc, ""
                Kill TmpPSFile
                wbInflight.SaveAs (wbInflightLoc2)
                wbInflight.Close False
        Else
            'do nothing
        End If
'Action if effort is active, and in test
        If Sheet2.Cells(I, 11).Value = 2 Then
            'code to come
        End If
 
        I = I + 1
        Set wbJIRA = Nothing
        Set wbResults = Nothing
        Set wbInflight = Nothing
    Loop
End Sub
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
failed to read the post fully (about saving as PDF) oops

cut
 
Upvote 0
I previously stated I have to use Distiller because saving to pdf directly from Excel messes up the location and format of the charts on the spread sheet.
 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,020
Members
448,939
Latest member
Leon Leenders

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top