Printing MS-Access-Report to PDF without Save-As-Dialogbox
Posted on 2004-10-18
Although this theme has already been discussed I have still no soution found for my problem.
I use WindowsXP with SP2, MS Office Prof 2000 and have installed Acrobat 6.0 Prof. (full version). Now I want to print the report from my Access-application to the PDF-Writer. Therefore I entered in the Registry the key which holds the desired filename and another key with the bDocInfo containing a zero. But every time I want to print the report will be generated but I am asked for the filename. In the meantime I did visit a lot of interesting internet pages but without success. It seems that Adobe has made serious changes in his PDF-Writer so the examples I found are now no more working.
The code is as follows:
'Save current default printer
sMyDefPrinter = bGetRegValue(HKEY_CURRENT_USER, "Software\Microsoft\WIndows NT\CurrentVersion\Windows", "Device")
' Set default printer to PDF Writer
bSetRegValue HKEY_CURRENT_USER, "Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", "Adobe PDF"
'Setting value for PDFFileName in the registry stops file dialog box from appearing
bSetRegValue HKEY_CURRENT_USER, "Software\Adobe\Adobe PDF", "PDFFileName", sPDFPath + sPDFName
bSetRegValue HKEY_CURRENT_USER, "Software\Adobe\Adobe PDF", "bDocInfo", 0
DoCmd.OpenReport rptName, acViewNormal
' Restore default printer
bSetRegValue HKEY_CURRENT_USER, "Software\Microsoft\WIndows NT\CurrentVersion\Windows", "Device", sMyDefPrinter
While running the program the entries in the registry are be done, printer switches to Adobe but the File Save Dialog Box still appears!
Any suggestions? Any help?
Thanks a lot for your comments.