VBA code and Cutepdf Printer

  • Hi,

    I'm trying to save excel files as pdf using vba code and the cutepdf printer. If I do this manually it works, but when I write code it saves the output to a file that cannot be read or opened

    Unfortunately I don't have access to the pdfdistiller so can't use this technique which I've seen described in a number of forums.

    The code I've used is below. Any help would be gratefully received.



  • Re: VBA code and Cutepdf Printer

    Are you sure you are setting the print to filename correctly?


    Actually I've found the problem, when you use PrintToFile it creates a PostScript file, not a PDF file.

    To see what I mean try opening the file in a text editor.


  • Re: VBA code and Cutepdf Printer


    Thanks for the below - Any idea how to tackle chaging it from the postscript file to an openable pdf?

    any help gratefully received

    thanks, joe.

  • Re: VBA code and Cutepdf Printer

    To automate cutePDF you need to purchase the developers version...


    Now to semi-automate it you can either print to a postscript file and then use a converter (I found this link http://www.cs.wisc.edu/~ghost/doc/cvs/Ps2pdf.htmfrom a Google search).

    or you can set cutePDF as your default printer
    Open your workbook
    Print the file
    Accept the default name
    Use VBA code to rename the file
    Loop back to the next printout.

    Admittedly this means sitting there pressing return to accept the default name, but it does work.



  • Re: VBA code and Cutepdf Printer


    Thanks - I think you're right, though, sitting and tapping enter may be the most straight forward solution if slightly more longwinded.

    I'll take a look at those online converters as well.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!