Professional Web Applications Themes

Creating PDF File from Excel using VBA Script - Adobe Acrobat Windows

I too had the same or similar problem. From what I have discovered, Adobe no longer allows you to printer directly to a .pdf file. You first must print to a Postscript file and then convert the Postscript file to a PDF file. Here is the code that I am now using: Please note that you need to set up a "Reference" to Acrobat Distiller in the VBA application ( Tools | References ) Sub PrintPDF() 'You first MUST set up a Reference to Acrobat Distiller in the VBA app.: Tools | References Dim myPDF As PdfDistiller Set myPDF = ...

  1. #21

    Default Re: Creating PDF File from Excel using VBA Script

    I too had the same or similar problem. From what I have discovered, Adobe no longer allows you to printer directly to a .pdf file. You first must print to a Postscript file and then convert the Postscript file to a PDF file.

    Here is the code that I am now using: Please note that you need to set up a "Reference" to Acrobat Distiller in the VBA application ( Tools | References )

    Sub PrintPDF()
    'You first MUST set up a Reference to Acrobat Distiller in the VBA app.: Tools | References

    Dim myPDF As PdfDistiller
    Set myPDF = New PdfDistiller

    Dim PSfilename As String
    Dim PDFfilename As String

    ' Define the postscript filename
    PSfilename = "c:\myPostScript.ps"
    ' Define the .pdf filename
    PDFfilename = "c:\myPDF.pdf"

    ' Print current sheet to the postscript file
    Dim MySheet As Worksheet
    Set MySheet = ActiveSheet
    MySheet.PrintOut copies:=1, preview:=False, ActivePrinter:="Acrobat Distiller", _
    PrintToFile:=True, collate:=True, PrToFilename:=PSfilename

    ' Convert the postscript file to .pdf
    myPDF.FileToPDF PSfilename, PDFfilename, ""
    End Sub

    Good luck, Dean
    Dean_Vayder@adobeforums.com Guest

  2. #22

    Default Re: Creating PDF File from Excel using VBA Script

    Dean,

    How were you able to add an Acrobat Distiller printer with Adobe 6? The only printer I can add is "Adobe PDF". That code is very similar to what we had working in Adobe 5, but no longer seems to work in 6 because we're unable to print to an Acrobat Distiller printer. Thanks for the help!

    Lee
    crazyguy007@adobeforums.com Guest

  3. #23

    Default Re: Creating PDF File from Excel using VBA Script

    Adobe PDF is the new name for the Distiller printer. Only the names
    have been changed to protect the innocent.

    Aandi Inston
    Aandi_Inston@adobeforums.com Guest

  4. #24

    Default Re: Creating PDF File from Excel using VBA Script

    I used the sendkeys method for that.

    sendkeys "C:\test\test.pdf"
    sendkeys "~"
    activesheet.printout

    (works when adobe PDF is preselected printer)
    But this is my problem too. It just works up to Version 5, not in 6.
    Cause the field for the filename is a dropdown list, not a simple
    textbox.
    Bernd_Marscheider@adobeforums.com Guest

  5. #25

    Default Re: Creating PDF File from Excel using VBA Script

    I work with excel files quite often and once my nephew asked me about one excel problem. I couldn't help him and started looking for the solution. And luckily found out it yesterday evening, he thanked me a lot and in my view in this situation the tool will be helpful
    Last edited by Ravish; September 4th at 03:34 PM. Reason: removed spam link
    zlatan24 is offline Junior Member
    Join Date
    Sep 2010
    Location
    New York
    Posts
    5

  6. #26

    Default Re: Creating PDF File from Excel using VBA Script

    Hi,

    It seems the above codes don't work for Adobe Acrobat 7 Pro and Excel 2003 :(. Can anyone please advice me which part of the codes should be changed to suit Adobe 7?

    Thanks a lot!
    Unregistered Guest

  7. #27

    Default Creating PDF File from Excel using VBA Script

    I just follow the code written here, and my "Device and Printer" is disappear
    does any one can help

    Thanks
    Unregistered Guest

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Creating Forms from Excel
    By Todd_Brewer@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 1
    Last Post: April 4th, 03:25 PM
  2. Creating Excel worksheets
    By arvindkutta in forum Coldfusion - Advanced Techniques
    Replies: 1
    Last Post: May 3rd, 08:03 AM
  3. Creating a tab delimited file for excel import
    By revdave in forum Macromedia ColdFusion
    Replies: 6
    Last Post: April 21st, 05:58 PM
  4. Place Excel into table with ability to link when native Excel file is updated.
    By Nancy_Bubb@adobeforums.com in forum Adobe Indesign Windows
    Replies: 1
    Last Post: June 23rd, 03:23 PM
  5. Creating Excel file + inserting values
    By Bertrand in forum ASP
    Replies: 2
    Last Post: October 1st, 05:48 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139