Problem printing files to Adobe PDF printer using VBA

I have an Excel project. Part of the code prints the active sheet range as a PDF file. Later code then sends the PDF file as an e-mail attachment. The Code was originally written using the free application PDFCreator and works as intended. However the client wants to use the Acrobat "Adobe PDF" printer instead.
Each PDF must have a name as specified in the code and must be sent to a specified folder, again as specified in the code.
The Adobe PDF printer insists on 1) using the path specified in the printer preferences and 2) naming it as the workbook name + .pdf.
I have checked the Distiller API reference and it tells me that if a key is set, the output path and name can be controlled. However, setting the key as described does not work. The PDF printer ignores it and creates another key named as the output file with a REG_SZ value that is numeric and increments each time print is invoked.
Attached is a screen shot of the registry entries.
What am I doing wrong?

I have.
However, I think I have solved this.
First, I am using Win 7 64 bit, so the application is not excel but c:\windows\splwow64.exe. I've modified my code so that both XP 32 and Win7 64 are catered for.
Second, the print command I used in VBA was
ActiveSheet.Printout ActivePrinter:= "Adobe PDF"
It looks like that starts a different Adobe DF printer to the one that would look at the registry. If I change the code to
ActiveSheet.Printout
and set Adobe PDF as the default printer in control panel, the whole thing works as planned.
All I need to do now is to set the printer to Adobe PDF within the code so the user doesn't have to do this in Control Panel. Obviously, my approach above didn't work, so what is the way to do this?
Here's the sub routine as it stands at the moment:
Public Sub PrintUsingAcrobat()
    Dim strOutFile As String
    Dim PDFPath As String
    Dim FileName As String
    Dim XPApplic As String
    Dim X64Applic As String
    XPApplic = Application.Path & "\excel.exe"
    X64Applic = "C:\Windows\splwow64.exe"
    Const HKEY_LOCAL_MACHINE As Long = &H80000002
    Const HKEY_CURRENT_USER As Long = &H80000001
    Dim lRC
    Dim sPath
    Dim objRegistry
    PDFPath = outpath ' outpath is a global variable set elsewhere
    strOutFile = Range("Suppliername") & ".pdf"
    FileName = PDFPath & strOutFile
    Set objRegistry = GetObject("winmgmts://./root/default:StdRegProv")
    sPath = "SOFTWARE\Adobe\Acrobat Distiller\PrinterJobControl"
    lRC = objRegistry.SetStringValue(HKEY_CURRENT_USER, sPath, XPApplic, FileName)
    lRC = objRegistry.SetStringValue(HKEY_CURRENT_USER, sPath, X64Applic, FileName)
    ActiveSheet.PrintOut
    DoEvents
End Sub

Similar Messages

  • Very slow printing to default Adobe PDF printer

    I have a 150 page FrameMaker document (with lots of linked Illustrator CS4 files) that is taking 7 MINUTES to print to the default Adobe PDF printer. In contrast, an old QuickSilver / Interleaf document that is 200 pages long and contains even more graphics embedded as huge TIF files, takes 20 seconds to print to the same default Adobe PDF printer.
    I have tried all the suggestions I can find on the web, including Adobe forums, but nothing works. Can anyone suggest why printing from FrameMaker 9 to Adobe PDF is taking such a long time? It would appear to be a FrameMaker problem, since every other application can print to the Adobe PDF printer without any problems, and so can FrameMaker... but only at a snail's pace!
    I am using TS2 (FrameMaker 9 and Adobe Acrobat 9 Pro Extended) on a 3.0 GHz Quad Core PC running Windows XP Pro.

    My computer
    Windows XP Professional
    Version2002
    Service Pack 3
    Intel(R) Pentium(R) 4CPU 3.00GHz
    2.99GHz, 3.25GB of RAM
    Using Acrobat 8.1 Professional. (Haven't upgraded because I saw too many posts with people having problems.)
    Using Adobe Design Premium CS3 (I use AI files, we always have for any vector files and way to many to change over to EPS.)
    We have also been changing over from Interleaf. I really like FM except for this problem. Very glad to get out of Interleaf.
    We also used InDesign for a while and there are no problems printing to pdf.
    ls

  • Avoiding the 'Save PDF File As' dialog when printing to the adobe PDF printer from a service

    Hello, can someone please help.
    I have Adobe Acrobat 8 Pro installed.
    I have an in house application which (among many other things) effectively monitors a directory and prints the file to the default printer. It works fine when run as an application.
    I have set the defaults on the Adobe PDF printer to put the output PDF file into a directory and not to open it so it works silently without prompts.
    When I run my application as a service, it brings up the 'Save PDF File As' dialog and I would like to avoid this. My impression is that if I put the right registry key in then it will work.
    I do not want to do any scripting if I can avoid it.
    Thanks for all constructive help given.

    Thank for your help Bill, but changing settings in the distiller did not seem to work. As my application prints directly to the default application without using anything specific to Acrobat, I was hoping there was a simple way forward. A colleague suggested copying registry entries from the account I logged on as to the S-1-5-18 entry, then rebooting. This had no effect as the prompt still comes up.
    Aandi, I don't have the Acrobat SDK or any experience of it.
    Also I'm not sure where any code/script would sit since the application is stable and so I would rather not change it.
    If it amounts to a few lines of javascript sitting outside the application then that would be of interest.

  • Now I can't print to the Adobe PDF printer

    At the same time I started having problems updating Acrobat (see my post yesterday, please), my Adobe PDF printer disappeared from system preferences. I've added it back using the help>repair option, but the printer no longer works.
    Every time I try to print, the printer pauses, then when I restart it and try to resume the document I get an error...
    Operation could not be completed
    Client-error-not-possible
    I've done a complete uninstall/reinstall of the whole Design Standard CS3 suite 3 times now, including removing my prefs and serial number (so starting from scratch), but this error, and the Acrobat updating problem, won't go away.
    Please can someone help me on these?
    Thanks, Nige

    Try going to Printer Utility and deleting any reference to the adobe Pdf Printer Driver.
    Then you find file anlocate all versions of PDF Printer. remove all traces of version Previous to this version.
    Now open Acrobat and got to help menu repair and replace and have it repair the Printer Driver again.
    Note: PDF Printer does not work within Acrobat nor Reader. only with other applications. (Or at least I've never been able to have it work within Acrobat/Reader.)

  • Problem Opening Hyperlink on Adobe .pdf Docs Using Safari Browser

    Does anyone have a problem opening a hyperlink on .pdf documents using Safari browser on iPhone or Mac computers?

    Kimmerdog, Would you please rewrite your sentence "you have to publish the document it to the repository". And what is a repository?

  • In windows 8 I can't print to an Adobe PDF printer

    Upgraded to windows 8 (forced to) and reloaded Adobe 8.  Even though it created the printer (PDF) it returns a printer error everytime you try to print to it.

    Did all the updates thru 8.1.7.  Now it tells me to print the document I need to activate Adobe which I did when I installed it.  Under the Help screen the activation tab is greyed out.  If I did de-activate it on my old laptop I don’t think it would change the state of this tab.
    T
    TERRY HUTCHENS
    PRESIDENT
    TCP LEASING, INC.
    cid:[email protected]
    TELEPHONE: 919.845.7320
    MOBILE: 919.810.7422
    CELEBRATING OUR 17TH YEAR

  • Adobe PDF printer - saves output file as filetype+filename need it to save only as filename

    I am using windows xp pro, when i create the pdf file with adobe PDF printer it creates the file name "Ami Pro - filename.pdf"  I really need it to create the file name as "filename.pdf".  Can you please help me - thank you

    Thank you Bernd - Explorer will let us change the file name one at a time, however I am creating numerous pdfs at a time, and its a pain to correct them one at a time, or to create a bat file to do this.  Does anyone know if the Adobe PDF printer has a feature that will eliminate the file type? thanks

  • Printing using Adobe PDF printer

    Dear all,
    I have a digital file with an .swf extension, that opens with a program Ebook_reader.exe. From within the opened (compressed adobe files) program I print to my Adobe PDF printer. The printer is a virtual printer used to create pdf files.
    The printing proces is almost fine, except for one detail that I cannot seem to fix by changing settings of teh Adbobe PDF printer.
    In the program I see the graphs clearly, and after I print them to PDF they seem funny.
    http://www.flickr.com/photos/117661095@N06/12538105853/
    When I open the file with Adbobe 8.0 (I know old ...) there seems to be a triangler layer inserted (first graph). Wiith the second graph the lines seem at an angle of 45 degrees ... also layered however when I delete these I delete the grid ... which is not what I would like.
    Does anyone know a way to get the above mentioned fixed?
    Kind regards,
    OS: windows 7, x64

    I have a g5 running Tiger. I updated my profile after posting my original question.
    The "Save as PDF..." button works, but not the button on the right that says "Print". It is important to me to be able to use that button, because it forces the application to print to the Adobe PDF virtual printer.
    Peter

  • Adobe PDF printer  - Use VBA??

    I am using Microsoft Access 2003 and have Acrobat 7 (Adobe PDF) and Acrobat 5 (Adobe PDF Writer) installed on my machine.   I can print to the Adobe PDF printer by using this code:
    Set Application.Printer = Application.Printers("Adobe PDF")
    DoCmd.OpenReport strReport, acViewNormal, , , acHidden
    I am trying to figure out if there is a way to use an Acrobat object to set the path and document name without user intervention (which the code above requires as a dialog pops up requesting that information).
    So, I am pretty good at figuring out how to use the various properties and methods of objects but I am just not sure WHICH objects I should be dealing with and I got lost in trying to read the SDK.
    Can anyone provide at least a push in the right direction?
    Bob
    P.S. If I posted this to the wrong forum or category, please do not just tell me that I did, but let me know where it should go.  I posted this originally to the wrong place and was told so, but I had to use a private message to the employee (who told me I had posted to the wrong place and locked the thread) in order to find out that THIS might be the proper location.

    "Adobe no longer supports Acrobat 7 (let alone Acrobat 5!!!)"
    Yeah, I know - I work for a large bank (contractor) and they move VERY SLOWLY with upgrades.

  • Printing Problem to Adobe PDF printer

    When I print to my Adobe PDF printer I comes out unreadable, but if I copy the unreadable text and paste into word I can read it.
    Unreadable text in Acrobat is in Courier, and readable in Acrobat is in Vernada (that's what is shows in word).  Does anyone have any ideas?
    Version Acrobat Pro 9.4.5

    I talked with Adobe and they showed me an option for fonts (listed below).  Uncheck the hightlighted option.
    And now it prints correctly.

  • I can't use Adobe PDF printer

    Hello,
    I can't print with my adobe pdf printer.
    My version is adobe acrobat 8
    Windows 8 64 bit.
    I have a message "error impression on adobe pdf..."
    NB : when I installed acrobat I had to decompress adobePDF.dll,
    Thx

    I have heard of no one who has been successful with AA8 on Win8. If you have any chance, you need to be sure you have updated Acrobat to the latest update to work with 64-bit systems.

  • PDFs created by Adobe PDF print device do not display correctly in Illustrator

    I generated a PDF from a PowerPoint file by printing to the Adobe PDF printer device. This step works correctly as the PDF appears normal in Acrobat. However, upon opening the PDF in Illustrator, none of the graphic (bitmap) elements are rendered correctly -- they appear as gray boxes with remnants of the correct image remaining as a single pixel border around the edge. This is clearly an error in the PDF importing in Illustrator. Any work-arounds or suggestions?
    Message was edited by: mcgrawcm
    Update: OK, so it has something to do with whether an image in PPT was "cropped" before conversion to PDF, as an uncropped version of the same graphic is rendered accurately in Illustrator after conversion to and from PDF. For my part, I'm just going to recopy the images directly into Illustrator, but perhaps this might help someone else dealing with the same problem.

    I understand this is no help, but Illustrator is not a pdf editor. This is why you can get unexpected results when importing a pdf in Illustrator.
    If you really need to edit a pdf you could use Acrobat or Neo, and there are some more out there, just look around on the net:
    http://www.google.be/search?client=safari&rls=en&q=pdf+editor&ie=UTF-8&oe=UTF-8&redir_esc= &ei=y6S3Tt-kOtSHhQe28fyiBA
    Greetings

  • Print to Adobe PDF printer from IE 7 crashes computer

    I apologize if this has already been answered somewhere in this forum, but I could not find mention of it....I have several users inside my company and out that are having issue with printing to the Adobe PDF printer from a webpage viewed in IE 7...the computer inevitably locks up and requires a restart. It seems to vary based on the version of Acrobat or Reader they have installed, but am wondering if anyone knows of the cause and resolution? It would seem to be a battle of Microsoft Operating System versus Adobe. Most users are on Windows XP Professional, using Adobe Acrobat and Reader 8 or better. Those with 6 do not appear to have issue.
    Have been circling around this problem for a month now....any help much appreciated!

    I think it's time to upgrade. 64-bit systems weren't much in use at the time of Acrobat 8.0.

  • Cannot print to Adobe PDF printer from Word after upgrading to Win 7 64bit

    Hi. After upgrading my operating system from Windows XP to Windows 7 64 bit, I can no longer print to the Adobe PDF printer (e.g. from Word). It just sits in the Adobe PDF printer queue saying "Error" without bringing up the "Save As" dialog box, and nothing happens. I am running Adobe Acrobat 8.0.0 (I've checked for updates but it says none are available). I have tried doing a repair installation following the instructions on this website (http://helpx.adobe.com/creative-suite/kb/error-file-adobepdf-dll-needed.html) but to no avail.
    Thank you in advance for your help.

    I think it's time to upgrade. 64-bit systems weren't much in use at the time of Acrobat 8.0.

  • Adobe pdf printer save dialog box opens in the background - progress bar shows Not Responding

    I have two users who have Acrobat X Pro version 10.1.4 that are experiencing the same things.  First, one person just changed laptops and the new one has a fresh Windows 7 Enterprise X64 image and new installation of Adobe Acrobat X Pro.  When he used the pdf printer for the first time(after opening the program and accepting the license agreement) he was in MS Excel '07 and chose file>print>Adobe PDF and then the progress bar came up and then showed not responding.  After he did this a couple of times with me standing there I noticed that the save dialog box was opening in the background because I could see the icon blinking on the taskbar.  He said that his old computer never did this and that it would always open up and ask where to save the file and never show 'not responding' on the progress bar.  The other person having the same issue is running the same version but she has had the program installed on her machine for a few months and an older version on before that. 
    Is there a way to make the dialog box show as soon as you print to the Adobe PDF printer?  What is causing this?  Is there another way to create a pdf from MS Office like the add-on? 

    I have two users who have Acrobat X Pro version 10.1.4 that are experiencing the same things.  First, one person just changed laptops and the new one has a fresh Windows 7 Enterprise X64 image and new installation of Adobe Acrobat X Pro.  When he used the pdf printer for the first time(after opening the program and accepting the license agreement) he was in MS Excel '07 and chose file>print>Adobe PDF and then the progress bar came up and then showed not responding.  After he did this a couple of times with me standing there I noticed that the save dialog box was opening in the background because I could see the icon blinking on the taskbar.  He said that his old computer never did this and that it would always open up and ask where to save the file and never show 'not responding' on the progress bar.  The other person having the same issue is running the same version but she has had the program installed on her machine for a few months and an older version on before that. 
    Is there a way to make the dialog box show as soon as you print to the Adobe PDF printer?  What is causing this?  Is there another way to create a pdf from MS Office like the add-on? 

Maybe you are looking for