+ Reply to Thread
Results 1 to 6 of 6

Create PDFs Using Excel VBA?

  1. #1
    Registered User
    Join Date
    12-07-2006
    Posts
    36

    Create PDFs Using Excel VBA?

    Hi.
    I'm trying to use VBA to automatically generate PDFs directly from an Excel worksheet.
    I found some code online, which is shown here:

    Please Login or Register  to view this content.
    But this doesn't seem to work.
    The code creates a postscript file, but instead of the associated PDF file I get a .log file with an error message in it:

    %%[ Error: undefined; OffendingCommand: JZJZ ]%%
    %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
    %%[ Warning: PostScript error. No PDF file produced. ] %%

    I'm using Excel 2003 with Adobe Acrobat Professional 8 with Distiller.
    BTW, in the VBE 'Tools' menu --> 'References' list, I have made sure that 'Acrobat Distiller' is ticked.

    Any ideas?
    Thanks for your help.

  2. #2
    Registered User
    Join Date
    08-10-2007
    Posts
    51
    Paste this into a module and run it. It works

    Please Login or Register  to view this content.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    What's your reason for going through Distiller rather than just printing to directly to PDF?

  4. #4
    Registered User
    Join Date
    08-10-2007
    Posts
    51
    I'm not sure how to print it directly to PDF's for some awkward reason, and hence, I printed it to a distiller. My printer settings will not recognize a printer to a pdf directly.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    My question was directed to iterature. Your code does print directly to PDF.

  6. #6
    Registered User
    Join Date
    12-07-2006
    Posts
    36
    Hi.
    Thanks for your help guys - sorry for the delay in getting back to you.

    The reason for not printing directly to PDF, is that I want to automate the process to create a large number of successive PDF documents.

    When I tried to write code to get Excel to print to PDF, I got a message-box each time asking for the filename for the PDF file.
    I want all the filenames of the PDFs to be created programmatically, so the whole process is automated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1